What Does “1>&2” Mean in Bash? [Duplicate]
What Does 1>&2 Mean in a Bash Script? for Instance, What Does the Following Line from a Bash Script Do? Echo "$1 Is Not a Directory!" 1>&2 I Use Macos X. My...
What does 1>&2 mean in a bash script?
For instance, what does the following line from a bash script do?
echo "$1 is not a directory!" 1>&2
I use MacOS X. My bash script is:
if [ ! -d $1 ]; then
echo "$1 is not a directory" 1>&2
exit 1
fi
1 Answer
It outputs the message to stderr. Therefore 1>&2 means redirect stdout to stderr.