freebsd-dev/bin
Jilles Tjoelker 484160a9cf sh: Add set -o pipefail
The pipefail option allows checking the exit status of all commands in a
pipeline more easily, at a limited cost of complexity in sh itself. It works
similarly to the option in bash, ksh93 and mksh.

Like ksh93 and unlike bash and mksh, the state of the option is saved when a
pipeline is started. Therefore, even in the case of commands like
  A | B &
a later change of the option does not change the exit status, the same way
  (A | B) &
works.

Since SIGPIPE is not handled specially, more work in the script is required
for a proper exit status for pipelines containing commands such as head that
may terminate successfully without reading all input. This can be something
like

(
        cmd1
        r=$?
        if [ "$r" -gt 128 ] && [ "$(kill -l "$r")" = PIPE ]; then
                exit 0
        else
                exit "$r"
        fi
) | head

PR:		224270
Relnotes:	yes
2019-02-24 21:05:13 +00:00
..
cat
chflags Add an example to the chflags(1) man page. 2018-06-12 16:44:13 +00:00
chio
chmod
cp
csh Don't mess with BLOCKSIZE in shell startup files - it's set by login.conf(5); 2019-01-20 22:08:49 +00:00
date Remove, the now very outdated, timed. 2018-12-15 21:34:40 +00:00
dd Replace hand-crafted naive byte-by-byte zero block detection routine 2018-11-29 19:28:01 +00:00
df
domainname
echo Convert cap_enter() < 0 && errno != ENOSYS to caph_enter() < 0. 2018-06-19 23:43:14 +00:00
ed Drop ed(1) "crypto" 2018-11-04 17:56:16 +00:00
expr expr(1): Fix overflow detection when operand is INTMAX_MIN 2018-04-14 04:35:10 +00:00
freebsd-version
getfacl Avoid copying a struct stat for acl_from_stat() calls. 2018-11-01 17:45:29 +00:00
hostname
kenv
kill
ln
ls ls(1): Gate the do_color_* definitions behind COLORLS 2018-08-18 21:03:19 +00:00
mkdir
mv
pax Add a note that the use of -B option does not guarantee a size of fragment 2018-12-29 23:08:59 +00:00
pkill Clarify that /dev/kmem is not used. 2018-12-03 20:01:51 +00:00
ps ps(1): Pet mandoc and igor 2018-10-31 17:47:08 +00:00
pwait
pwd pwd: mark usage as dead 2018-06-17 05:14:50 +00:00
realpath
rm rm(1): Formalize non-functional status of -P flag 2018-11-10 20:26:55 +00:00
rmail
rmdir
setfacl Don't set NFSv4 ACL inheritance flags on non-directories. 2018-10-26 21:17:06 +00:00
sh sh: Add set -o pipefail 2019-02-24 21:05:13 +00:00
sleep Convert cap_enter() < 0 && errno != ENOSYS to caph_enter() < 0. 2018-06-19 23:43:14 +00:00
stty stty.1: Document kern.tty_info_kstacks behavior (r339471) 2018-10-20 18:53:32 +00:00
sync
test
tests
uuidgen Convert cap_enter() < 0 && errno != ENOSYS to caph_enter() < 0. 2018-06-19 23:43:14 +00:00
Makefile
Makefile.inc