From owner-freebsd-bugs Wed Mar 18 00:01:53 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id AAA24337 for freebsd-bugs-outgoing; Wed, 18 Mar 1998 00:01:53 -0800 (PST) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from dt050n33.san.rr.com (@dt050n33.san.rr.com [204.210.31.51]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id AAA24161; Wed, 18 Mar 1998 00:00:04 -0800 (PST) (envelope-from Studded@dal.net) Received: from dal.net (Studded@localhost [127.0.0.1]) by dt050n33.san.rr.com (8.8.8/8.8.8) with ESMTP id XAA03160; Tue, 17 Mar 1998 23:59:56 -0800 (PST) (envelope-from Studded@dal.net) Message-ID: <350F7EFC.4EF45447@dal.net> Date: Tue, 17 Mar 1998 23:59:56 -0800 From: Studded Organization: Triborough Bridge & Tunnel Authority X-Mailer: Mozilla 4.04 [en] (X11; I; FreeBSD 2.2.6-BETA-0316 i386) MIME-Version: 1.0 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 References: <199803180104.RAA13084@hub.freebsd.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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