When I run a Centos 7 Docker Image like this
docker run -it centos:7 bash
Running something which is uses Process Substitution is fine (as expected, as Bash supports Process Substitution since the beginning of time - Bash 1.4.x actually).
For example:
while IFS= read -r test; do echo $test; done < <(cat anaconda-post.log)
But when I switch to /bin/sh the same code doesn't work anymore
/bin/sh
while IFS= read -r test; do echo $test; done < <(cat anaconda-post.log)
sh: syntax error near unexpected token `<'
Although /bin/sh seems to be Bash
/bin/sh --version
GNU bash, version 4.2.46(2)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
But then why doesn't process substitution work anymore? Other non-POSIX features seems to work, though
echo ${PATH//:/ }
/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin
while IFS= read -r test; do echo $test; done < anaconda-post.log
/bin/bash --version
instead of/bin/sh --version
.centos:7
(8652b9f0cb4c
).4.2.46(2)-release (x86_64-redhat-linux-gnu)
./bin/sh
. Or don't use/bin/sh
if you want to use bashisms. - "Although /bin/sh seems to be Bash" - Never rely on that; it may work now, but it may not work in the future, or on another system.