File descriptor before a command

Manikandan Kbk DIP

What does this mean? to have the file descriptor before a command line utility.

Example,

>&2 echo "Hey there! Something failed"

Afaik, it should have been at the end of a command line utility or a program.

echo "Hey there! Something failed" 1>&2

Which at least gives a fair readability to the reader that even the stdout is copied to stderr

I came across such a line of code in one of the Open source git-hub project. Not able to understand the usage

Shawn

The position of the redirection operators doesn't matter - some people like putting them at the beginning of a command, some people like the end. The shell itself doesn't care.

From the bash manual:

The following redirection operators may precede or appear anywhere within a simple command or may follow a command.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related