help-bash
[Top][All Lists]
Advanced

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

Re: What does `echo xxx 1>&2xxx` do?


From: Koichi Murase
Subject: Re: What does `echo xxx 1>&2xxx` do?
Date: Sat, 8 May 2021 12:12:57 +0900

2021年5月8日(土) 11:57 Peng Yu <pengyu.ut@gmail.com>:
> I see `echo xxx 1>&2xxx` generates no error messages, nor returns an
> error status. Is this correct? Thanks.

It is interpreted as "1>& FILENAME" where FILENAME is `2xxx', which is
the deprecated form of "&> FILENAME" described in Manual 3.6.4.

https://www.gnu.org/software/bash/manual/bash.html#Redirecting-Standard-Output-and-Standard-Error
> 3.6.4 Redirecting Standard Output and Standard Error
>
> This construct allows both the standard output (file descriptor 1)
> and the standard error output (file descriptor 2) to be redirected
> to the file whose name is the expansion of word.
>
> There are two formats for redirecting standard output and standard
> error:
>
>         &>word
>
> and
>
>         >&word



reply via email to

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