[Top][All Lists]

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

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

From: Dale R. Worley
Subject: Re: `&>' doesn't behave as expected in POSIX mode
Date: Sun, 20 Jun 2021 16:51:31 -0400

Oğuz <oguzismailuysal@gmail.com> writes:
>     $ set -o posix
>     $ uname &>/dev/null
>     $
> `uname &' and `>/dev/null' should be parsed as two separate commands;
> that, if I'm not missing anything, is what POSIX says. But bash
> doesn't do that in POSIX mode, and redirects both stderr and stdout to
> `/dev/null'.

An interesting point!  At least according to the 2018 edition, a Posix
shell parses that command as


which is two commands, "uname &" and ">/dev/null".  The second command
is a no-op.  Whereas default mode Bash parses it as uname with a

This may be the only situation where Posix mode differs from default
mode in *lexing*.  And at least in my antique version, the --posix
switch doesn't make that change.


reply via email to

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