Chapter 5

CREATING, VIEWING, AND EDITING TEXT FILES

STDIN, STDOUT, STDERR

NUMBER
CHANNEL NAME
DESCRIPTION
DEFAULT CONNECTION
USAGE

0

stdin

Standard input

Keyboard

read only

1

stdout

Standard output

Terminal

write only

2

stderr

Standard error

Terminal

write only

3+

filename

Other files

none

read and/or write

redirection
redirects

command > file

redirect and overwrite to file

command >> file

redirect and append to file

command 2> file

redirect stderr and overwrite file

command 2>/dev/null

redirect stderr to /dev/null

command > file 2>&1

1) redirect stdout and overwrite file, then 2) redirect stderr to stdout (same file) file contains both stdout and stderr

command &> file

same with above example

command >> file 2>&1

1) redirect stdout and append file, then 2) redirect stderr to stdout (same file) file contains both stdout and stderr

command &>> file

same with above example

command 2>&1 > file

1) redirect stderr to stdout (terminal), then 2) redirect stdout to file stderr prints to terminal, file only contains stdout

Redirectionu pipe ilə işlətdiyimiz vaxt, pipe-dan sonrakı komandaya stdin daxil olmur.

Bu kimi hallarçün tee işlətmək lazımdır. tee özündən əvvəlki komandadan gələn stdout-u stdin kimi qəbul edir, və özündən sonrakı pipe-a stdout kimi ötürür.

To set persistent variables look for these files:

Last updated

Was this helpful?