Having been a long time user of 4DOS in my pre-win95 days, I had developed some batch files and/or aliases that I were quite handy in that environment. Switching to another operating system that’s more flexible with the command line, I’ve re-implemented some of those batch files and aliases. Here’s one of my favorites, and while it’s pretty simple, I use it all the time. It switches to a folder using the pushd command, executes your chosen command, and then uses popd to switch back to the original folder. It has no error checking of it’s own and it has no instructions. I did it in this fashion to keep it as light and quick as possible.
#!/bin/bash
## In Folder script by Joshua Kersey
## http://www.forwardyouth.com/ubuntu
pushd "$1"
"$2"
popd
Let me know if you’ve got any suggestions for improvement.
Save This Page

Fashion » My Useful In Folder Script | 06-Apr-08 at 12:01 am | Permalink
[...] Ubuntu For Free wrote an interesting post today on My Useful In Folder ScriptHere’s a quick excerptI did it in this fashion to keep it as light and quick as possible…. [...]