This blog points to articles written on http://kirk.webfinish.com. These articles are mainly about shell scripting, PHP, and postgresql on Ubuntu and OS/X.
bash shell script to use getopts with gnu style long positional parameters
Posted 11-03-2009 at 05:04 PM by roybal
Here's a script that will accept --gnu-style-long-parameters and interpret them appropriately.
http://kirk.webfinish.com/2009/10/ba...al-parameters/
http://kirk.webfinish.com/2009/10/ba...al-parameters/
Total Comments 2
Comments
-
Coincidentally, I've just gone through this very exercise. Your approach is an interesting alternative to mine, and I'll bear it mind for the future.
FYI, my approach in this case was to simply use all short options for the script itself, and then convert them to the long options in the case statement. It wouldn't work for something with a large set of options, too messy.
For example, the application takes a long option of --file filename, I use -f in the script:
Code:case $opts in f) file="--file $OPTARG" ;; esac # call the app app "$file"
Cheers,
NickPosted 11-04-2009 at 06:13 AM by padeen -
Quote:
/bitheadPosted 11-17-2009 at 12:46 PM by roybal