Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com From: "Markus Hoenicka" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <14957.40803.113000.724225@gargle.gargle.HOWL> Date: Tue, 23 Jan 2001 15:12:35 +0000 (CT0) To: cygwin AT cygwin DOT com Subject: using of getopts in bash In-Reply-To: References: X-Mailer: VM 6.75 under Emacs 20.6.1 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