![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to redirect stderr from top with csh | umen | Shell Programming and Scripting | 2 | 02-22-2007 10:19 PM |
| csh stderr redirection | jolok | Shell Programming and Scripting | 0 | 04-15-2005 07:03 AM |
| 'tee' STDERR output (ksh) | gsatch | Shell Programming and Scripting | 5 | 08-21-2002 09:19 AM |
| stderr redirection in csh script | thehoghunter | Shell Programming and Scripting | 0 | 01-28-2002 07:15 AM |
| stderr | dell9 | High Level Programming | 1 | 11-21-2001 03:49 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
stderr redirection
Does anyone know away of redirecting the stderr for a bourne or korn shell script to a file.
|
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
I though it was the same for all shells?
This shold produce a file 'junk.txt' with an error from stderr Code:
$ RunFail > junk.txt 2>$1 |
|
#3
|
||||
|
||||
|
Actually it's:
$ RunFail > junk.txt 2>&1 That is you need an ampersand, not a dollar sign. And that syntax will not work with csh or csh clones. |
|
#4
|
|||
|
|||
|
Thanks Perderabo.
I I rewrite it as: RunFail >> junk.txt 2>>&1 will it append to the file? |
|
#5
|
||||
|
||||
|
There is no such thing as 2>>&1
>> junk.txt will open the file in append mode and attach it to fd 1 2>&1 will duplicate fd 1 and attach it to fd 2. You use this form for everything. It does not matter how fd 1 came to exist. |
|
#6
|
||||
|
||||
|
Opps to my typo
thanks Perderabo |
||||
| Google The UNIX and Linux Forums |