Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Mar 1998 00:10:01 -0800 (PST)
From:      Studded <Studded@dal.net>
To:        freebsd-bugs
Subject:   Re: bin/6047: bash does not handle -e option properly
Message-ID:  <199803180810.AAA25607@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/6047; it has been noted by GNATS.

From: Studded <Studded@dal.net>
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199803180810.AAA25607>