![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| comparing PID values of 2 Files in shell Options | marconi | Shell Programming and Scripting | 2 | 12-19-2007 10:02 AM |
| Scripts that take String options | hanhanbib | Shell Programming and Scripting | 2 | 10-18-2007 08:52 PM |
| Adding PATH variable in the startup scripts | rajanishshetty | UNIX for Dummies Questions & Answers | 5 | 03-02-2007 09:51 AM |
| Difference between writing Unix Shell script and AIX Shell Scripts | haroonec | AIX | 0 | 04-11-2006 11:27 PM |
| Options for csh shell | luiz_fer10 | UNIX for Dummies Questions & Answers | 10 | 06-03-2002 01:24 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Adding -options to shell scripts
I'm sure this is something simple I am overlooking somehow. I'd like the ability to pass -options into my shell scripts. For example my file called "input.sh" I can do the following:
root# ./input.sh 1 and it will result: root#./input.sh 1 You passed me a 1 Just like an init script, etc. I would like to be able to do: root# ./input -m 1 and have the -m specify a different result in the case statement. Like: root# ./input.sh -m 1 You passed me a -m 1 #! /bin/bash case "$1" in 1) echo "You passed me a 1" ;; 2) echo "You passed me a 2" ;; *) commands; ;; esac Thanks for any suggestions as always guys. |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
look into 'man getopt'
|
|
#3
|
|||
|
|||
|
Quote:
|
|
#5
|
|||
|
|||
|
Quote:
It does indeed seem much more complicated than it really is. |
|||
| Google The UNIX and Linux Forums |