Option-ize your shell scripts

Thursday, March 01 2007 @ 01:18 PM CST

Contributed by: Linegod

From BSDPants:

If you're like me you may have started shell scripting very simply, maybe just to collect a number of other unwieldy commands into one executable file to call with just one short command (the name of the script). Over time (hopefully!), you will have discovered many of the other useful features of shells, like variables, redirections, and conditional expressions. As one's scripts become more complicated, one mistake a person might make is to copy and then modify a script to do something that's really only a little bit different. A better way to handle this may be to keep it all in one script and just use command line options to that script. Once you start using options to your scripts (as opposed to just arguments), all sorts of great possibilities open up.

Read the full thing at http://bsdpants.blogspot.com/2007/02/option-ize-your-shell-scripts.html

Comments (0)

Warped Systems