Date: Tue, 17 Mar 1998 17:04:26 -0800 (PST) From: dancy@franz.com To: freebsd-gnats-submit@FreeBSD.ORG Subject: bin/6047: bash does not handle -e option properly Message-ID: <199803180104.RAA13084@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 6047
>Category: bin
>Synopsis: bash does not handle -e option properly
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Tue Mar 17 17:10:01 PST 1998
>Last-Modified:
>Originator: Ahmon Dancy
>Organization:
Franz Inc.
>Release: 3.0-971225-SNAP
>Environment:
FreeBSD news2.franz.com 3.0-971225-SNAP FreeBSD 3.0-971225-SNAP #0: Mon Feb 23 08:20:57 PST 1998 root@news2.franz.com:/usr/src/sys/compile/NEWS i386
>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.
>How-To-Repeat:
Run my script above.
>Fix:
>Audit-Trail:
>Unformatted:
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?199803180104.RAA13084>
