So I have a bash command using process substitution in an exec line that stopped working recently, and it boils down to this example:
Contents of script.sh:
#!/bin/bash
ls -l "$1" >/tmp/out
echo "SUCCESS" > "$1"
This works, putting "SUCCESS" into log
:
rm -f log; ./script.sh >(cat >log)
Using tail
also works:
rm -f log; ./script.sh >(tail >log)
Using exec
with cat
works:
rm -f log; exec ./script.sh >(cat >log)
But.. exec
with tail
does NOT work:
rm -f log; exec ./script.sh >(tail >log)
In all cases, the contents of /tmp/out look okay, looking something like:
l-wx------ 1 user user 64 Oct 14 10:55 /dev/fd/63 -> pipe:[158518]
Why does cat
work but not tail
or head
? This was working at sometime in the past.. is this a bash feature change or bug regression..?
bash --version: GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu)