Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Feb 2026 16:07:28 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 293212] bin/sh does not set exitstatus for heredoc expansion errors
Message-ID:  <bug-293212-227@https.bugs.freebsd.org/bugzilla/>

index | next in thread | raw e-mail

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=293212

            Bug ID: 293212
           Summary: bin/sh does not set exitstatus for heredoc expansion
                    errors
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: bdrewery@FreeBSD.org
                CC: jilles@FreeBSD.org

```
#! /bin/sh
cat <<EOF
echo "${EMPTY:?}"
EOF
ret=$?
echo $ret
exit $ret
```

Exit statuses:

- sh: 0
- dash: 2
- zsh: 1
- bash: 1

All print `wtf.sh: line 7: EMPTY: parameter null or not set` but /bin/sh does
not set exitstatus to non-0 and does not trigger `set -e`.

-- 
You are receiving this mail because:
You are the assignee for the bug.

home | help

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