Shell Redirections ↔ Quick Guide
File descriptors:
stdin
: 0stdout
: 1stderr
: 2
Redirecting stdin
stdin
This trick can be used to take multi-line input in scripts.
Redirecting stderr
stderr
Use
2>
. Compatible with bothbash
andsh
Redirecting both stderr
& stdout
stderr
& stdout
With
bash
, usesome_command &> /dev/null
With
sh
,If you want to capture standard output/error separately,
Last updated