The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
what is the right syntax ?? convenientstore Shell Programming and Scripting 7 06-04-2007 01:21 AM
csh syntax charlie11k UNIX for Dummies Questions & Answers 0 05-31-2007 11:29 PM
vim and syntax max os kezzol OS X (Apple) 1 04-30-2007 11:22 AM
Help with the syntax chandhar Shell Programming and Scripting 2 03-25-2007 10:48 PM
What does this syntax mean... DrAwesomePhD UNIX for Dummies Questions & Answers 1 07-31-2006 08:54 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 03-26-2007
Registered User
 

Join Date: Mar 2007
Location: chennai, India
Posts: 9
Help with the syntax

can anyone explain the code for me... i am new to shell programming

while getopts ":S:D:U:" OPTION "$@"
do
case $OPTION in
S) SRVR=$OPTARG;;
D) DB="$OPTARG"; USEDB="use $OPTARG";;
U) UID=$OPTARG;;
:) MISSINGOPTARG="$MISSINGOPTARG -$OPTARG";;
?) if [ "$OPTARG" = "?" ]
then
HELP=1
else
UNEXPECTEDOPT="$UNEXPECTEDOPT -$OPTARG";
fi;;
esac
done
Reply With Quote
Forum Sponsor
  #2  
Old 03-26-2007
Registered User
 

Join Date: Feb 2007
Posts: 44
HI,

Code:
while getopts ":S:D:U:" OPTION "$@" --->The possible options are specified 
                                                         here
do
case $OPTION in 
S) SRVR=$OPTARG;;    -->Handling the option S -->OPTARG will have the 
                                    value for the oprion S
D) DB="$OPTARG"; USEDB="use $OPTARG";;
U) UID=$OPTARG;;
:) MISSINGOPTARG="$MISSINGOPTARG -$OPTARG";;
?) if [ "$OPTARG" = "?" ]
then
HELP=1
else
UNEXPECTEDOPT="$UNEXPECTEDOPT -$OPTARG";
fi;;
esac  --->End of switch /case
done
Thanks
Raghuram

Last edited by vgersh99; 03-26-2007 at 04:47 AM. Reason: vB Codes
Reply With Quote
  #3  
Old 03-26-2007
Registered User
 

Join Date: Mar 2007
Location: chennai, India
Posts: 9
Thanks for ur help
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 09:48 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0