Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: Bob Vickers <bobv@dcs.rhbnc.ac.uk>
To: Maximillien Lincourt <max@toonboom.com>
Subject: Re: Sh shell script problem on OSF4.0 (but not on SGI) (getopts and shift)
Date: 1997/05/28	[thread overview]
Message-ID: <338BF0E4.41C6@dcs.rhbnc.ac.uk> (raw)
In-Reply-To: 33831D34.41C6@toonboom.com


Maximillien Lincourt wrote:
> 
> I'm trying to use the getopts argument parser in a sh shell script, on
> DEC's OSF1 (4.0 and on SGI 6.x) but I seem to be having some soft of
> problems using it. It seems that the getopts does not get called! is the
> man page wrong or there's something I don't understand, could it be that
> getopts path is wrong ?
> 
> There's also a problem with the shift  command, is the syntax correct
> with all the parentheses on the sh man page on SGI they use
> 
> shift `expr $OPTIND - 1`
> 

As far as I can make out, /bin/getopts is a total waste of space,
written by someone who doesn't know the first law of Unix programming:
"A Unix process cannot alter the environment of its parent".

getopts has to be a shell built-in command, otherwise it won't work. ksh
has it, bash has it and many implementations of sh have it.

Change the first line of your script to #!/bin/ksh
and you should begin to get consistent behaviour between SGI and DEC.

Any comments from DEC about this?

Bob
-- 
======================================================================
Bob Vickers			R.Vickers@rhbnc.ac.uk
Dept of Computer Science, Royal Holloway College, University of London
WWW:	http://www.dcs.rhbnc.ac.uk/%7Ebobv/
Phone:	+44 1784 443691



  reply	other threads:[~1997-05-28  4:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-05-21  4:00 Sh shell script problem on OSF4.0 (but not on SGI) (getopts and shift) Maximillien Lincourt
1997-05-28  4:00 ` Bob Vickers [this message]
1997-05-28  4:00   ` Chet Ramey
1997-06-09  4:00     ` David Boyce
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