Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Replacing getopts with zparseopts
- X-seq: zsh-users 16028
- From: Thorsten Kampe <thorsten@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Replacing getopts with zparseopts
- Date: Sun, 15 May 2011 16:34:55 +0200
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
Hi,
"From Bash to Z Shell" mentions that one could possibly use zparseopts
instead of getopts - for instance to get long GNU style options ("--
long-option"). Unfortunately neither the book nor the man page were too
helpful (my fault) in "translating" the standard option case.
Could someone help me to create the below simple construct with
zparseopts and making sure that "-d" and "--debug", "-h" and "--help",
and "-v" and "--verbose" refer to the same option?!
##
while getopts dhv opt
do case $opt in
(d) setopt xtrace;;
(h) print_help
exit;;
(v) print_version
exit;;
(\?) print_usage >&2
exit 1;;
esac
done
##
Thanks in advance,
Thorsten
Messages sorted by:
Reverse Date,
Date,
Thread,
Author