Brian's Waste of Time

Wed, 30 Nov 2005

Some (Possibly) Useful Tools

I saw Bruce's post about (the incredibly useful) pbcopy/pbpaste today. They rock! That said, they are not quite what I need a lot of times, so here are a couple quick tools I whipped together for ye shell bangers.

get and put : These are basically a clipboard for the shell. Get takes input from standard in and stashes it. It is like yank or copy in a gui. Put does the opposite, it takes whatever get stashed and spews it to standard out (paste). No biggie, but useful: (I inserted the blank lines in the output, for readability)

brianm@kite:~/src/activemq$ cat build.properties | get

brianm@kite:~/src/activemq$ cd ../wombatattack

brianm@kite:~/src/wombatattack$ put > activemq.properties

brianm@kite:~/src/activemq$ cd ../wombatdefense

brianm@kite:~/src/wombatdefense$ put > activemq.properties

Now, the more fun tools are push and pop which are like put and get except they operate on a stack =)

brianm@kite:~/src/jdbi$ for x in $(find . -name Test*.java); do echo $x | push; done 

brianm@kite:~/src/jdbi$ pop
./src/test/org/skife/jdbi/TestSQLOperations.java

brianm@kite:~/src/jdbi$ pop
./src/test/org/skife/jdbi/TestScriptStuff.java

brianm@kite:~/src/jdbi$ pop
./src/test/org/skife/jdbi/TestRowMap.java

brianm@kite:~/src/jdbi$ pop --clear

The shocking part is that, as far as I know, these type of tools aren't part of the standard shell environment!

4 writebacks [/src/ruby] permanent link