From: klaus@axp4.physik.fu-berlin.de (Wolfram Klaus)
Subject: Re: getopts does not work in a shell script
Date: 1998/08/27 [thread overview]
Message-ID: <klaus.904222379@axp4.physik.fu-berlin.de> (raw)
In-Reply-To: 35E51F9E.80F9DD04@nospam.ethz.ch
Regionalfernsehen Kuessnacht <rfk@geocities.com> writes:
>Hi
>I tried to use the getopts command to process options in a shell script,
>without success. The options processing works as follows:
>#!/bin/sh
>while getopts fdi opt
>do
> case $opt in
> 'f') echo full ;;
> 'd') echo differential ;;
> 'i') echo incremental ;;
> '?') echo options: [-fdi]
> exit 2 ;;
> esac
>done
>I tried the same script also on a sun with unix. It works correctly
>there,
>but not on the DEC. Please help.
>Thank you.
I just played around a little and found out that the example at the
end of the man-page of getopts works if you either use
#!/bin/ksh
or set the environmet variable BIN_SH to xpg4 and use
#!/bin/sh
thus getting the POSIX.2 version of the shell instead of the
historical SVR4 version.
Maybe this helps you,
Wolfram
> Tom
>__________________________________________________________
>To avoid spam I replaced my email addres.
>Replace 'nospam' with 'ife.ee' to send me a mail
--
"""
(o o)
+---------------------------------oOO--(_)--OOo-------------------------------+
| Wolfram Klaus (klaus@physik.fu-berlin.de) FU Berlin, FB Physik |
prev parent reply other threads:[~1998-08-27 4:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-08-27 4:00 getopts does not work in a shell script Regionalfernsehen Kuessnacht
1998-08-27 4:00 ` Bob Harris
1998-08-27 4:00 ` Wolfram Klaus [this message]
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox