[WBEL-users] script bash and options
Vincent.Raffensberger at dtn.com
Vincent.Raffensberger at dtn.com
Wed May 25 10:37:18 CDT 2005
You want to use getopts, like this:
while getopts ":c:h:j:" opt; do
case $opt in
"c")
echo do something with "-c"
;;
"h")
echo do something with "-h"
;;
"j")
echo do something with "-i"
;;
?)
echo -e "$opt isn't an option. Try again."
exit 1
;;
esac
done
Jean Lee <jean.lee at free.fr>
Sent by: whitebox-users-bounces at beau.org
05/25/2005 10:14 AM
To
whitebox <whitebox-users at beau.org>
cc
Subject
[WBEL-users] script bash and options
Hello,
I would like to had an option when I launch my script in bash (like :
backup.sh -c -h -j --usersdenied="kl")
I know that an argument can be passed to a command line ($1, $2,....)
but I don't know how to write the script properly to :
- write the options in a different order (for example : backup.sh -j -h
-c ...)
- write the options like this : -jhc
- options may not be wrotten too.
Or perhaps that I made a mistake and options are not arguments (like
with : ls -l)
Does anybody knows ?
Thank you for your answer,
Jean
_______________________________________________
Whitebox-users mailing list
Whitebox-users at beau.org
http://beau.org/mailman/listinfo/whitebox-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://beau.org/pipermail/whitebox-users/attachments/20050525/619ef191/attachment-0001.htm
More information about the Whitebox-users
mailing list