![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| UNIX newbie NEWBIE question! | Hanamachi | UNIX for Dummies Questions & Answers | 3 | 09-14-2006 07:23 AM |
| newbie question | xzyan | UNIX for Dummies Questions & Answers | 6 | 08-08-2006 07:22 AM |
| Newbie question | peeyush_23 | Shell Programming and Scripting | 9 | 02-18-2005 03:39 PM |
| Newbie Question... | flopper | UNIX for Dummies Questions & Answers | 4 | 11-27-2001 01:51 PM |
| newbie question | ninja | UNIX for Dummies Questions & Answers | 3 | 07-11-2001 01:34 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
newbie question
hey all, I have repeatedly seen scripts containing the following syntax,
grep "hello" $myfile >> $log 2>&1 can anyone explain exactly what "2>&1" mean? THANK YOU |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Care to read the man pages ? See the section REDIRECTION under man sh.
|
|
#3
|
|||
|
|||
|
while i am waiting other to help on my question, let me explain it to you !!
grep "hello" $myfile >> $log -----> all standard output will go into $log, except error which will output to your screen. for this reason,we use 2>&1 ----> so that (2)=all error will go into (1)=standard output which you have already define as $log so all output including error message wll all go into $log Anyway man page will explain in more detail.... |
|
#5
|
|||
|
|||
|
In unix 1 is defaut file descriptor for stdout and 2 is default file descriptor for stderr. So when you try redirecting on any of them you will redirect the stderr or stdout to a file or /dev/null.
regards Apoorva Kumar |
|||
| Google The UNIX and Linux Forums |