getopt . more on parse command options

commandline session

$getopt hello
 --
$getopt helloo
 --
$getopt hellooo
 --
$getopt hellooo how
 -- how
$getopt hellooo how are
 -- how are
$getopt h how are
 -- how are
$getopt h h h
 -- h h
$getopt ab -a
 -a --
$getopt ab -ab
 -a -b --
$getopt ab -ab -R
getopt: invalid option -- 'R'
 -a -b --
$getopt ab -ab -l
getopt: invalid option -- 'l'
 -a -b --
$getopt ab -abl
getopt: invalid option -- 'l'
 -a -b --
$getopt ab -abn
getopt: invalid option -- 'n'
 -a -b --
$getopt ab -abc
getopt: invalid option -- 'c'
 -a -b --
$getopt nl -nl
 -n -l --
$getopt R -nl
getopt: invalid option -- 'n'
getopt: invalid option -- 'l'
 --
$getopt R -R
 -R --
$

Leave a comment

Your email address will not be published. Required fields are marked *