Meaning of >&2


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Meaning of >&2
# 1  
Old 12-11-2009
Meaning of >&2

What does >&2 at the end of the statement echo "Alright man..." >&2 mean?
# 2  
Old 12-11-2009
those are Standard Input, Standard Output and Standard Error

standard input 0 - default is keyboard
standard output 1 - default is screen
standard error 2 - default is screen

in your statement standard output is redirecting to standard err ( or where the stderr is redirected later) ..
this is somewhat confusing to me !!
# 3  
Old 12-11-2009
Yes absolutely correct by anchal_khare

This thing creates confusion,
>&2 and >&1 both of this showing o/p on screen.


If u possible proactiveaditya copy past some more lines from this file.
# 4  
Old 12-11-2009
&2> means redirecting errors into a file.

For eg
Code:
grep "TEST"  file1 > file2 &2> errorFile

If there is any error in the grep command it will be directed to the error file.
# 5  
Old 12-11-2009
I got the syntax from the page:
The classic test command [Bash Hackers Wiki]
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

SFTP Shell Script Get & Delete && Upload & Delete

Hi All, Do you have any sample script, - auto get file from SFTP remote server and delete file in remove server after downloaded. - only download specify filename - auto upload file from local to SFTP remote server and delete local folder file after uploaded - only upload specify filename ... (3 Replies)
Discussion started by: weesiong
3 Replies

2. UNIX for Beginners Questions & Answers

&& meaning in UNIX

Hi Team, I know that "&" holds the result of current pattern match. But what does "&&" means and its use please? Thanks & Regards, Batta Archana (6 Replies)
Discussion started by: Archana Batta
6 Replies

3. Shell Programming and Scripting

meaning of &1

All, In the below mentioned line --- $SCRIPT_FILES/wrapper_sleep.ksh > $MVXREFLOG 2>&1 what is the meaning of &1 here. Regards Oracle User (2 Replies)
Discussion started by: Oracle_User
2 Replies

4. Shell Programming and Scripting

Replace & sign to &amp word

Hi, I have text file abc.txt. In this file, I have the following data. Input: Mr Smith &amp Mrs Smith Mr Smith &apos Mrs Smith Mr Smith & Mrs Smith Mr Smith& Mrs Smith Mr Smith &Mrs Smith Output: Mr Smith &amp Mrs Smith Mr Smith &apos Mrs Smith Mr Smith &amp Mrs Smith Mr Smith&amp... (4 Replies)
Discussion started by: naveed
4 Replies

5. Shell Programming and Scripting

replace & with & xml file

Hello All I have a xml file with many sets of records like this <mytag>mydata</mytag> <tag2>data&</tag2> also same file can be like this <mytag>mydata</mytag> <tag2>data&</tag2> <tag3>data2&amp;data3</tag3> Now i can grep & and replace with &amp; for whole file but it will replace all... (4 Replies)
Discussion started by: lokaish23
4 Replies

6. Shell Programming and Scripting

PHP read large string & split in multidimensional arrays & assign fieldnames & write into MYSQL

Hi, I hope the title does not scare people to look into this thread but it describes roughly what I'm trying to do. I need a solution in PHP. I'm a programming beginner, so it might be that the approach to solve this, might be easier to solve with an other approach of someone else, so if you... (0 Replies)
Discussion started by: lowmaster
0 Replies

7. Shell Programming and Scripting

What is the meaning of $_

Hi, Can somebody tell the usage of "$_" cd $_ ? and ls $_ ? (4 Replies)
Discussion started by: giri_luck
4 Replies

8. Shell Programming and Scripting

meaning of & in sh shell

All, I have a line in my code like below , could any one please tell me what this actually mean what is the & doding there. I am in sh shell #!/bin/sh .............. mv &fname &III.tar.gz Thanks in Advance, Arun (1 Reply)
Discussion started by: arunkumar_mca
1 Replies

9. Shell Programming and Scripting

Meaning of "> /dev/null 2>&1"

Hi, I am new into UNIX shell scripting and I am wondering what is the meaning of the below text which appears at the end of each line in the ".sh" file: > /dev/null 2>&1 For example, the line below: sh $HOME/stats/Rep777/Act_777.sh omc omc > /dev/null 2>&1 I know for sure what "sh... (10 Replies)
Discussion started by: salanalani
10 Replies

10. UNIX for Dummies Questions & Answers

meaning of .& in shell

Hi , can anyone explain me the meaning of following line ". &13FNAME/version_encours/cfg/dfm.cfg" Regards (1 Reply)
Discussion started by: scorpio
1 Replies
Login or Register to Ask a Question