what is 2> and 1> and <<?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting what is 2> and 1> and <<?
# 1  
Old 05-11-2007
what is 2> and 1> and <<?

Too bad google didn't support symbol serach.
I wished to find explanations on them on google.
# 2  
Old 05-11-2007
This is called redirection. You can check the man page of sh/ksh/bash for more details. Check the 'REDIRECTION' section of bash in particular.
# 3  
Old 05-12-2007
2> file_name #Redirect stderr to file file_name

1> file_name # Redirect stdout to file file_name


&> file_name #Redirect both stdour and stderr to file file_name

<< file_name # Redirect file file_name
# 4  
Old 05-13-2007
what is 2> and 1> and <<?

Quote:
Originally Posted by onthetopo
Too bad google didn't support symbol serach.
I wished to find explanations on them on google.

1> FILE redirect standard output (stdout) of a command to FILE

Example (the output of the command will be placed in the file, FILES; any error messages will appear on the screen):

Code:
ls [a-z]* 1> FILES

2> FILE redirect standard error (stderr) of a command to FILE

Example (the output of the command will appear on the screen; any error messages will be placed in the file, ERRORLOG):

Code:
ls qwerty asdfg 2> ERRORLOG

CMD <<EOF Use the following lines (known as a here document) as input to CMD. The here document ends with the second EOF on a line by itself.

Example (the lines between EOF and EOF command will appear on the screen):

Code:
cat <<EOF
This a test
of a here document
EOF

Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question