![]() |
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 |
| Using getopts | TurboArkhan | Shell Programming and Scripting | 3 | 06-22-2009 04:31 PM |
| Help in getopts | chella | Shell Programming and Scripting | 4 | 11-02-2007 01:09 AM |
| getopts help | GrepMe | Shell Programming and Scripting | 3 | 06-20-2007 11:47 AM |
| help in getopts | problems | Shell Programming and Scripting | 1 | 05-04-2006 11:07 PM |
| getopts | Shell Programming and Scripting | 3 | 12-05-2002 07:42 PM | |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
getopts
I have a script which fires a command based on certain parameters. I am posting the code below..
The options needs be given such that -u option goes along with -d and -s, -f goes with -d and -t goes with -s and -d. 1) How do I ensure that user misses any of the option then he should be prompted . Is it simple if then else where I check the length of string of all these options. USAGE="Usage: `basename $0` [-s schemaname] [-d databasename] [-u username] -f -t -h" while getopts :s:d:u:fth params do case $params in s) SOURCESCHEMA="$OPTARG" ;; f) FULL='y' ;; t) TABLE='y' ;; d) DBNAME="$OPTARG" ;; u) USERNAME="$OPTARG" ;; h) help_doc exit 0 ;; ?| echo "Invalid Option Specified" echo "$USAGE" 1>&2 ; exit 1 ;; esac done Thanks.. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|