From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Markus Hoenicka" To: cygwin@cygwin.com Subject: using of getopts in bash Date: Tue, 23 Jan 2001 07:00:00 -0000 Message-id: <14957.40803.113000.724225@gargle.gargle.HOWL> References: X-SW-Source: 2001-01/msg01102.html 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.berndl@sdm.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.Hoenicka@uth.tmc.edu http://ourworld.compuserve.com/homepages/hoenicka_markus/ -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple