What is the use of file descriptor 255 in bash process What is the use of file descriptor 255 in bash process linux linux

What is the use of file descriptor 255 in bash process


The open files are 0 (stdin), 1 (stdout), and 2 (stderr). 255 is a little trick that bash uses to keep a copy of these for when they are redirected. This is specific to bash.

Source: https://books.google.com/books?id=wWjqCF9HLfYC&pg=PA231

Example:

echo foo 1>/dev/null 2>/dev/null >/proc/$$/fd/255

Output:

foo