From owner-freebsd-bugs Wed Mar 18 00:10:02 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id AAA25615 for freebsd-bugs-outgoing; Wed, 18 Mar 1998 00:10:02 -0800 (PST) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: (from gnats@localhost) by hub.freebsd.org (8.8.8/8.8.8) id AAA25607; Wed, 18 Mar 1998 00:10:01 -0800 (PST) (envelope-from gnats) Date: Wed, 18 Mar 1998 00:10:01 -0800 (PST) Message-Id: <199803180810.AAA25607@hub.freebsd.org> To: freebsd-bugs Cc: From: Studded Subject: Re: bin/6047: bash does not handle -e option properly Reply-To: Studded Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR bin/6047; it has been noted by GNATS. From: Studded To: dancy@franz.com Cc: freebsd-gnats-submit@freebsd.org, freebsd-bugs@freebsd.org Subject: Re: bin/6047: bash does not handle -e option properly Date: Tue, 17 Mar 1998 23:59:56 -0800 dancy@franz.com wrote: > > >Number: 6047 > >Category: bin > >Synopsis: bash does not handle -e option properly Bash != /bin/sh > >Description: > The following shell script does not work as it should: > > #!/bin/sh > set -e > > is_net_dir_p() > { > case $1 in > /net/*) > return 0 > ;; > *) return 1 > ;; > esac > } > > if is_net_dir_p freebsd; then > echo okay > fi > echo done > > --- > A properly working /bin/sh would print 'done' and exit. Currently > nothing is printed and the shell silently exits. > > The man page for 'sh' says: > > -e errexit > If not interactive, exit immediately if any untested command > fails. The exit status of a command is considered to be explic- > itly tested if the command is used to control an if, elif, while, > or until; or if the command is the left hand operand of an ``&&'' > or ``||'' operator. Actually it's doing just what it should. Your function fails, so the shell should exit silently. You can demonstrate by commenting out the set line and running the script again. Also, I'm not sure what /net/* is supposed to be testing for, but that looks an awful lot like you're mixing perl syntax with sh. What are you actually trying to accomplish here? Doug -- *** Chief Operations Officer, DALnet IRC network *** *** Proud operator, designer and maintainer of the world's largest *** Internet Relay Chat server. 5,328 clients and still growing. *** Try spider.dal.net on ports 6662-4 (Powered by FreeBSD) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message