![]() |
|
|
|
|
|||||||
| 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 |
| search for a file - errors redirected | matrixmadhan | AIX | 1 | 07-18-2005 01:12 AM |
| redirected output | slavam | Shell Programming and Scripting | 2 | 10-12-2004 10:47 AM |
| tail -f a log file redirected into a new window? | douknownam | Shell Programming and Scripting | 2 | 06-01-2004 01:34 PM |
| Standard output not redirected from /bin/sh | soorajmu | UNIX for Dummies Questions & Answers | 1 | 09-19-2003 07:47 AM |
| Saving a redirected file | JSP | UNIX for Dummies Questions & Answers | 1 | 09-27-2001 03:52 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
redirected output not going to file for all cases
I have to confirm that an engine was not able to run. In the output below you see that it indeed got errors, but it didn't send those messages to the output file. When I run the same thing with a different executable it works. So does this mean something in the executable could cause it not to go to the output file??
$ cd Tar $ ./Engine > ../engine_output.txt exec(): 0509-036 Cannot load program ./Engine because of the following errors: 0509-150 Dependent module libodbc.a(libodbc.so.1) could not be loaded. 0509-022 Cannot load module libodbc.a(libodbc.so.1). 0509-026 System error: A file or directory in the path name does not exist. $ cd .. $ cat engine_output.txt $ ls AIX_50_ODBC_test.sh engine.tar engine_result.txt Tar engine_output.txt $ |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
The errors are going to stderr (2) Normal output goes to stdout (1)
Code:
$ ./Engine 2>&1 > ../engine_output.txt |
|
#3
|
||||
|
||||
|
Quote:
Code:
$ ./Engine > ../engine_output.txt 2>&1 |
|
#4
|
|||
|
|||
|
You're correct, but as far as this code goes, both streams end up written to to log file.
|
|
#5
|
||||
|
||||
|
I disagree:
Code:
#!/bin/ksh # # test.sh : demonstrate redirection # # echo "I am stdout" echo "I am stderr" >&2 Code:
# ./test.sh > log1 I am stderr # cat log1 I am stdout Code:
# ./test.sh 2>&1 > log2 I am stderr # cat log2 I am stdout Code:
# ./test.sh > log3 2>&1 # cat log3 I am stdout I am stderr |
|
#6
|
|||
|
|||
|
Thanks guys. This helps alot.
|
|
#7
|
|||
|
|||
|
This works for all my normal executions. But on one machine, a coredump is expected on one command. We don't care, just need to confirm the version info. This is output from the exe:
$ ./Up -*-*- XXXXXXX UPDATE XXXXX Version nnnnnnnn -*-*- -*-*- Copyright (C) 1998-2007 xxxxxxxxxxxxxx, Inc. -*-*- Processing begins: 10/4/2007 10:48:12 Tracking Database Connect Error Memory fault(coredump) However, when I send the output to a file, the output file is empty: $ ./Up > ../Up_output.txt 2>&1 Memory fault(coredump) $ cd .. $ cat Up_output.txt $ |
|||
| Google The UNIX and Linux Forums |