Mail Archives: cygwin/2001/01/23/10:04:34
Some real-world example:
# read the command line options
while getopts ":d:hi:p:t:" opt; do
case $opt in
d ) stylesheet=$OPTARG;;
h ) echo "creates formatted output from a DocBook SGML source"
echo 'usage: dbjade [-d style] [-h] [-i name] [-p prefix] [-t outformat] file1 [file2...]'
echo "Options: -d select stylesheet (d=default, m=m4, s=dbslide)"
echo " -h print this help and exit"
echo " -i set variable name in OpenJade"
echo " -p use prefix for output filenames"
echo " -t select the output format. Possible values are html,"
echo " rtf, dvi, pdf, ps, tex, tps, tpdf. Default is tex."
exit 0 ;;
i ) includearg="-i "$OPTARG;;
p ) prefix=$OPTARG;;
t ) outformat=$OPTARG;;
\? ) echo 'usage: dbjade [-d style] [-h] [-i name] [-p prefix] [-t outformat] file1 [file2...]'
echo 'type dbjade -h to invoke help'
exit 1;;
esac
done
# correct the index so the filename argument is always $1
shift $(($OPTIND - 1))
klaus DOT berndl AT sdm DOT de writes:
> Has anybody an easy understanding example for me how to use the bash build in command "getopts"
> (or where i can find such an example)?? This would help me a lot...
>
--
Markus Hoenicka, PhD
UT Houston Medical School
Dept. of Integrative Biology and Pharmacology
6431 Fannin MSB4.114
Houston, TX 77030
(713) 500-6313, -7477
(713) 500-7444 (fax)
Markus DOT Hoenicka AT uth DOT tmc DOT edu
http://ourworld.compuserve.com/homepages/hoenicka_markus/
--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple
- Raw text -