11-03-2014
First of all, did you know that your log will only contain the standard output stream (stdout)?
Use
yourscript $var 2>&1 | tee $LOG to capture the standard error (stderr) stream too. This might help you with the potential troubleshooting process.
In bash, there is a special internal array variable called $PIPESTATUS, which may work relatively reliable for the simple case you mention.
${PIPESTATUS[0]} should hold the exit status of the first command in the pipe.
Source:
Internal Variables
This User Gave Thanks to junior-helper For This Post:
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi there,
I'm trying to find files that are greater then 30 days old, zip them and move to a different directory. I'm encountering an issue passing a variable (FilesToFind) to name within the find command. Here's the code I'm running:
#! /usr/bin/sh
FileDir=/home/ariba... (2 Replies)
Discussion started by: ParNone
2 Replies
2. Solaris
Hi there, I have upgraded my explorer (SUNWexplo) on a solaris 10 Sparc box from version 3.4 to the latest version (5.5) . However im a little concerned, whenever I run the new explorer either manually or scheduled, I get a syslog event as follows
1 in 0:08:31: Sep 22 17:00:15 fmy.machine.com... (8 Replies)
Discussion started by: hcclnoodles
8 Replies
3. Solaris
Hi there
I have a box that at 4pm started recieving soft errors on a DIMM, normally this is ok and we have time to swap it out. But I got the following error which caused the box to reboot
NOTE: there were abount 6 or 7 normal "soft error encountered" messages before this one
Nov 7... (1 Reply)
Discussion started by: hcclnoodles
1 Replies
4. UNIX for Dummies Questions & Answers
Hi,
Is it possible that the output of a command is piped into a unix function? Just like in below:
#!/bin/ksh
concat(){
echo Orbix
}
echo "Hello there" | concat
How to manipulate the output of a command inside the function? (2 Replies)
Discussion started by: Orbix
2 Replies
5. Shell Programming and Scripting
Hi all, Just want to say thanks for the great forum you have here, the old topics and posts have helped tremendously. So much so that I have managed to figure a lot out just by researching. However, I'm having a small issue that I simply can't find the answer to. (4 Replies)
Discussion started by: whyte_rhyno
4 Replies
6. Shell Programming and Scripting
I have a long busybox ash script that has 3 stages.
1. Identify and Capture information on variable data sources, output the information to text file on each data source.
2. Using data from 1 above now actually do data processing on each individual dataset.
3. Produce report.
So... (6 Replies)
Discussion started by: tesser
6 Replies
7. Shell Programming and Scripting
Hi All,
Please hav a look at the below peice of script and let me know if there are any syntax errors.
i found that the below peice of Script is causing issue. when i use SFTP its working fine, but there is a demand to use FTP only. please find below code and explain if anything is wrong... (1 Reply)
Discussion started by: mahi_mayu069
1 Replies
8. Shell Programming and Scripting
My OS is Linux GL version 2.4.26. I am trying to make a shell script that outputs a chart displaying info of who is online, boot time, and the real time, I have manage to get it to work, but I still get the error "./user/script: line 1: : command not found." I do in fact have access to root, if... (2 Replies)
Discussion started by: thatguy565
2 Replies
9. Shell Programming and Scripting
I am trying to check multiple server's "uptime" in a loop over "ssh".
When I execute multiple ssh commands with hard coded servernames script is executing fine.
But when I pass server names using while loop, script is exiting after checking first server's status, why?
# serverList... (8 Replies)
Discussion started by: kchinnam
8 Replies
10. Shell Programming and Scripting
I need to declare a function, this function will contain a script, this script cannot be in a file but must be piped. and then, for the script to run, i need to pass arguments to it.
everything has to be on one line. so i'm basically looking for a one-liner
here's what i'm doing:
myfunc ()... (3 Replies)
Discussion started by: SkySmart
3 Replies