The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




Thread: getopts
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 03-26-2005
yerra yerra is offline
Registered User
  
 

Join Date: Jan 2005
Posts: 13
I added this line at the end of the script (after getopts), maybe the approach is wrong..

if [ $# -eq "3" ]; then
"Option 1 specified -s -d -u"
elif [ $# -eq "2" ]; then
"Option 2 specified -d and -f"
fi

However $# always evaluates to 6 if provide the option
scriptname -d databasename -u username -s schemaname. How did it arrive at 6 ?