I've encountered the 2>&1
syntax in Bash previously, and from this question I understand that it means to redirect the output of stderr to stdout. However, I've also encountered the syntaxes in the title, and can find nothing on StackOverflow or Google as to their meaning.
They occurred in this Bash completion script on GitHub, and in particular this function:
# Run something, muting output or redirecting it to the debug stream
# depending on the value of _ARC_DEBUG.
__python_argcomplete_run() {
if [[ -z "$_ARC_DEBUG" ]]; then
"$@" 8>&1 9>&2 1>/dev/null 2>&1
else
"$@" 8>&1 9>&2 1>&9 2>&1
fi
}
I'm sure that the comment is meant to be a clue, but I had no idea that there was an "8" and a "9" when it came to Bash streams. I'm only aware of 0 as stdin, 1 as stdout and 2 as stderr. What do 8 and 9 mean in Bash, and what do these redirects mean?