Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getopts with long flag

Status
Not open for further replies.

meetramana

Programmer
Feb 2, 2005
57
US
is there any way to do the following using getopts in korn shell ?

myscript.ksh -input inputfilename -ouput outfilename

instead of

myscript.ksh -i inputfilename -o outfilename

where inputfilename and outfilename are the real filename and the rest are flags except the scriptname.

The above is just an example of what I am trying to do

I know it can be done through if and shift operators, but I like the getopts validation. SUN operating system accommodates something like with long flags such as

getopts "i:(input)" arguments
.....

but that requires to be invoked as
myscript.ksh --input inputfiles ....
not
myscript.ksh -input inputfile
 
Please don't cross-post

Ceci n'est pas une signature
Columb Healy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top