kpreid: (Default)
2011-06-17 09:42 am

(no subject)

Something I still miss from the ORCA development shell for the Apple IIgs (at least, I think that's where it was) is the option to interpret a command name which is directory as a command to change to that directory; essentially letting you omit “cd ”.

kpreid: (Default)
2010-10-04 05:47 pm
Entry tags:

Unix tip

The following command is not idempotent:

cat * > cat.txt
kpreid: (Default)
2010-06-17 05:56 pm

A useful shortcut for working on documents with build processes

$ cat ~/bin/maken
#!/bin/sh
# Make files and view the results.
make "$@" && open "$@"

UPDATE: Turns out I posted this previously, with further thoughts: Avoiding repeating myself (on the command line).

kpreid: (Default)
2009-10-27 09:37 pm

Avoiding repeating myself (on the command line)

I was working on some automated document generation, building the process, revising the input document, and checking the results, and got tired enough of typing "make output/foo.txt && open output/foo.txt" and then going back and editing that line when I wanted to check the PDF version etc. that I wrote a tool which I hope will have more general application as well. I called it “maken”:

#!/bin/sh
# Make files and view the results.
make "$@" && open "$@"

Or it could be generalized into being a combinator, running any two commands, rather than just make and open, specified as the first two arguments:

#!/bin/sh
ca="$1"
shift
cb="$1"
shift
"$ca" "$@" && "$cb" "$@"

(Which, for the Haskell folks, should be called &&&, except that that would be annoying to enter in the shell.)

kpreid: (Default)
2009-09-21 11:18 pm

(no subject)

Every time you write “ | ” in shell, that's concurrent programming.