On Sun, Jun 20, 2021 at 10:18:59AM -0400, Eli Schwartz wrote:
>
> *Neither* behavior is similar to e.g. dash's behavior, or for that
> matter ksh. Both print the uname output after registering it as a
> backgrounded job (redirection does not get applied to the command itself).
Quick comparission script (note my default bash version in 5.0.3(1) and my
current working directory is my last bash-5.1.8 built):
$ echo $BASH_VERSION $PWD
5.0.3(1)-release /tmp/bash/bash-5.1.8
$ for KindOfShell in csh ksh dash 'busybox sh' {,./}'bash --posix' ; do
printf "\n#< %s >#\n" ${KindOfShell%% *}
LANG=C $KindOfShell -xc 'uname &>/dev/null ls -ld /t{mp,nt}'
done
#< csh >#
[1] 587
uname
Linux
ls -ld /tmp /tnt
ls: cannot access '/tnt': No such file or directory
[1] + Done uname
#< ksh >#
+ ls -ld /tmp /tnt
+ 1> /dev/null
+ uname
Linux
ls: cannot access '/tnt': No such file or directory
#< dash >#
+ ls -ld /t{mp,nt}
+ uname
Linux
ls: cannot access '/t{mp,nt}': No such file or directory
#< busybox >#
+ uname ls -ld '/t{mp,nt}'
#< bash >#
+ uname ls -ld /tmp /tnt
#< ./bash >#
+ uname ls -ld /tmp /tnt
There is some *different* behaviours... (but against `/t{mp,nt}` too!)
--
Félix Hauri - <[email protected]> - http://www.f-hauri.ch