I have seen lots of entries on stderr and stdout, but I did not see a solution to my question.
In running a script, I call another script. I want to capture output and error messages from the called script. I am able to redirect the stdout from the called script to my output file, but I don't seem able to capture the stderr portion.
Here is my line calling the script:
$READSCRIPT is the outside script I am calling.
$ERRFILE is a file name parameter I am passing to that script
$MAILFILE is the output file
When I run the script: sh -x tim_gap
Here is an example of an error message in the screen output:
gzcat: 00035146.20110829_-_2342+1900.gz: No such file or directory
However, when I look at my output file, $MAILFILE, the error message does not exist. I do capture the stdout messages into $MAILFILE. Am I using the proper syntax?
Hello all,
I have a for loop executing in a script that I want to redirect STDOUT to screen and to file, while directing STDERR to the bit bucket. Here is the general sentax of what I'm doing:
for i in thingy
do
some_command ${i}
done 1>&1 | tee ${LOGFILE} 2> /dev/null
What I am... (2 Replies)
I have Mac OS X, and I wrote a bash shell script that does some encryption of files. When the user of the script does something wrong I want it to send an error message to the stderror of the script. Here's the code snippet I have:
printf "$1: File not found\nNote: This script will only work... (6 Replies)
Hi,
I have a script which does multiple tasks in sequence. When i execute the script, it runs and displays lot of messages for each of the steps on the console. Is there any way I can capture those messages and store it for audit purposes ?
Best Regards,
bornon2303 (2 Replies)
Hi,
I would like to run a job based on the output from the SQL output.
Eg: Select count(*) from A ...if count(*) = 1 then execute the next step or else exit.
Please advise.
Thanks
S (2 Replies)
Operating System: Solaris 10, Shell
We are outputting the results of our scripts to the stderr file. However we have encountered a problem where some of the lines in the file are truncated.
Is there a way to increase the terminal or column size within the script so that this does not... (4 Replies)
I am trying to redirect the output from stderr to a log file from within a bash script. the script is to long to add 2> $logfile to the end of each command. I have been trying to do it with the command exec 2> $logfile This mostly works. Unfortunately, when a read command requires that anything be... (5 Replies)
Ih all,
i have multiples ksh scripts for crontab's unix jobs
they all have same variables declarations and some similar functions
i would have a only single script file to declare my variables, like:
var1= "aaa"
var2= "bbb"
var3= "ccc"
...
function ab { ...}
function bc { ... }... (2 Replies)
Hi,
I have one shell script which is calling a C executable. That C executable returns a value depending upon operations inside the C code. But how to get that value in the calling shell script?
The syntax of calling the C executable is like --
C_exec <argc no> <argument1> <argument2> etc... (5 Replies)
I have the following line in my script:
$sftpcmd $rmthost <<COMMANDS>> $sftplog 2>&1
For some reason this is not capturing the errors from sftp, they go to the file attached to the cron entry
ie
mm hh dd MM * /myscript > cron.out
any idea why?
digital unix 4.0d (6 Replies)
Man pages....look at the man pages. If you don't have them, you can find them on-line. Read them when you have nothing better to do. Find new commands and new ways of doing things.
The answer:
The only way to direct the standard output and standard
error separately is by invoking... (0 Replies)