bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: `&>' doesn't behave as expected in POSIX mode


From: felix
Subject: Re: `&>' doesn't behave as expected in POSIX mode
Date: Mon, 21 Jun 2021 08:57:51 +0200
User-agent: Mutt/1.10.1 (2018-07-13)

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  -  <felix@f-hauri.ch>  -  http://www.f-hauri.ch



reply via email to

[Prev in Thread] Current Thread [Next in Thread]