Configuration Information [Automatically generated, do not change]: Machine: i686 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I../bash -I../bash/include -I../bash/lib -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall Machine Type: i686-pc-linux-gnu
Bash Version: 4.2 Patch Level: 37 Release Status: release Description: I have seen "read -d '' var" to read multi-line heredocs into shell variables. An empty argument to -d seemed to mean "read up to the end of input". And this is what it does. When using this in a script of mine, I noticed that this fails when errexit is set ("set -e"). I concede that from the documentation of "read" I should not have thought it would accept an empty -d argument, but * why does it work with "set +e" ? * what is the recommended way to disable splitting with "read"? Repeat-By: set +e read -d '' var1 <<EOF no problem here EOF echo "$var1" set -e read -d '' var2 <<EOF but this fails EOF echo "$var2" Fix: I would appreciate if the "read" documentation would clarify how to disable splitting.