Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: OPTARG not being set?



Sweth Chandramouli wrote:

...
>         this is the start of the function:
> 
> unset USER_SPECIFIED_PATH;
> while getopts ":p" CMD_LINE_OPT ; do
>    case ${CMD_LINE_OPT} in
>       p  ) USER_SPECIFIED_PATH=${OPTARG};;
>       \? ) print "unknown option \"-${OPTARG}\""
>            print 'usage: '
>            print 'addpath [-p PSEUDO_ARRAY] first_item:second_item:...:nth_item'
>            return 1
>    esac;
> done;
> 
>         after this loop finishes, however, USER_SPECIFIED_PATH is still
> null.  i've put some echo statements in the case clause for option p,
> which confirm that OPTARG is never being set, even though CMD_LINE_OPT
> is matching 'p'.  does anyone have any idea why?

Options with arguments are denoted as "p:". ":p" has a different
meaning; see "man zshbuiltins".

Regards,
	Bernd
-- 
Bernd Eggink
Regionales Rechenzentrum der Uni Hamburg
eggink@xxxxxxxxxxxxxx
http://www.rrz.uni-hamburg.de/eggink/BEggink.html




Messages sorted by: Reverse Date, Date, Thread, Author