LANGUAGE » SHELL_SCRIPT » FISH

Redirection

Usage

File descriptor numbering:

NumberFile Descriptor
0stdin
1stdout
2stderr

Examples

Redirect stdout to stderr:

fish
echo 'to stderr' >&2

Redirect stdout or stderr to file (use >> to append output):

fish
command < stdin_input
command > stdout_output
command 2> stderr_output

Redirect everything to file:

fish
command &> stdout_stderr_output
command > stdout_stderr_output 2>&1