Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Fucking getopts, how does it work?

Name: Anonymous 2010-09-27 6:15

Is getopts builtin in most shells?
I've been told that it should work fine in bsh, bash and ksh. Dunno about the BSD/GNU implementations.

I want it to parse something like this:
scriptname {0 or more directories} destinationdirectory
scriptname -c destinationdirectory
scriptname -v {o or more directories}
scriptname -i {0 or more directories} destinationdirectory



Is it possible to parse with getopts or should I do it "by hand"?

Thanks in advance for any tip or information on implementation.

Name: Anonymous 2010-09-28 6:33

>>1
It is possible, and I've heard that Google has plenty of examples, but I cannot check it myself for you. Please see his websight http://google.com/

>>9
Oh blindman!
getopt is POSIX utility, it is a part of libc with getopt.h.
getopts is a bash (zsh etc) builtin.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List