![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| for:badly formed number | ROOZ | Shell Programming and Scripting | 3 | 06-05-2008 05:35 PM |
| tail | grep lagging badly | WasabiVengeance | Shell Programming and Scripting | 3 | 04-22-2008 06:53 PM |
| awk Shell Script error : "Syntax Error : `Split' unexpected | Herry | UNIX for Dummies Questions & Answers | 2 | 03-17-2008 11:16 AM |
| Error: Internal system error: Unable to initialize standard output file | firkus | UNIX for Dummies Questions & Answers | 2 | 10-25-2005 03:23 PM |
| New to it all, But i wanna script really badly!!! | TheNewGuy | Shell Programming and Scripting | 3 | 07-03-2004 10:33 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Badly placed ()'s. - error
Hi,
when I execute the below script, I am getting following error "Badly placed ()'s". can anyone please help me fix ---------------------------------------------------------- # Usage: ani -n -a -s -w -d # # # help_ani() To print help # help_ani() { echo "Usage: $0 -n -a -s -w -d" echo "Options: These are optional argument" echo " -n name of animal" echo " -a age of animal" echo " -s sex of animal " echo " -w weight of animal" echo " -d demo values (if any of the above options are used " echo " their values are not taken)" exit 1 } # #Start main procedure # # #Set default value for variable # isdef=0 na=Moti age="2 Months" sex=Male weight=3Kg # #if no argument # if [ $# -lt 1 ]; then help_ani() fi while getopts n:a:s:w:d opt do case "$opt" in n) na="$OPTARG";; a) age="$OPTARG";; s) sex="$OPTARG";; w) weight="$OPTARG";; d) isdef=1;; /?) help_ani;; esac done if [ $isdef -eq 0 ] then echo "Animal Name: $na, Age: $age, Sex: $sex, Weight: $weight (user define mode)" else na="Pluto Dog" age=3 sex=Male weight=20kg echo "Animal Name: $na, Age: $age, Sex: $sex, Weight: $weight (demo mode)" fi ------------------------------------ THx Amit |
| Bits Awarded / Charged to amitrajvarma for this Post | |||
| Date | User | Comment | Amount |
| 07-23-2009 | unni.raj | Include the line #!/usr/bin/ksh in the very first line of the code | 0 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|