Linked Questions
34 questions linked to/from Get exit status of process that's piped to another
12
votes
3
answers
7k
views
How can I pipe output to another process, but retain the error state of the first process? [duplicate]
Possible Duplicate:
Get exit code of process that's piped to another
I am using the following command line (in a makefile) to pipe the verbose error messages from my compiler through a perl ...
10
votes
2
answers
23k
views
How do I capture the return status and use tee at the same time in korn shell? [duplicate]
Consider Source code:
1. Parent.sh
#!/usr/bin/ksh
# No tee
ksh Child.sh;
exit_status=$?;
echo "Exit status: ${exit_status}"
# Using tee
ksh Child.sh | tee -a log.txt;
exit_status=$?;
echo "Exit ...
6
votes
2
answers
264
views
Use ts without losing exit value [duplicate]
I have a build script that executes a long command that produces lots of output which went like this:
./compile
In order to troubleshoot compilation performance, I want to use ts (from moreutils) ...
4
votes
2
answers
1k
views
How to capture the exit status of a non-final command in a pipeline? [duplicate]
I want to capture the exit status of a command that takes place somewhere in a pipeline before the last position. For example, if the pipeline is something like
command_1 ... | command_2 ... | ...
2
votes
2
answers
4k
views
exit code of the command **before** last? [duplicate]
I'm running a script within a script, release.sh and caller.sh (caller.sh calls release.sh). Both are bash.
release.sh contains a bunch of conditions with 'exit 1' for errors.
caller.sh contains a ...
2
votes
1
answer
2k
views
Check for failure of piped command [duplicate]
Possible Duplicate:
Get exit code of process that's piped to another
If I pipe the output of one command into another, is there a way for me to check explicitly whether the first command ...
2
votes
1
answer
2k
views
Get exit code from preceding command before pipe [duplicate]
I have this:
node ${SUMAN_RUNNABLE} | tee -a run.sh.log
EXIT_CODE=$?;
but it looks like the exit code is always 0 because tee is providing the code not the node executable.
Is there a way to ...
2
votes
1
answer
548
views
How to get exit status of a particular command in a pipeline? [duplicate]
I am running this while loop in a script to take mysqldump and compress it, but I want to exit the script if the table doesn't exist. Below is what I have tried.
while read TABLES; do
sudo ...
4
votes
1
answer
1k
views
returncode of command in a pipline [duplicate]
The following script runs on Solaris using /bin/ksh and on Linux using /bin/sh
cmd | tee -a cmd.log | tail
exit $?
The output of cmd is saved in a file cmd.log and the last lines are displayed on ...
7
votes
0
answers
266
views
how to get exit status from the command before the last [duplicate]
I have solaris machine ( solaris 10 )
please Look on the following simple commands (haconf -makerw | grep -iq "Cluster already writable")
# haconf -makerw
VCS WARNING V-16-1-10364 Cluster ...
0
votes
1
answer
153
views
Determine failing command in Bash pipe when working with set -o pipefail [duplicate]
I'm using set -o pipefail in my scripts as usual. That works perfectly well and as documented for something like
curl ... | jq ... | psql ...
However, is there a way to determine which command along a ...
1
vote
0
answers
67
views
How to capture "$?" before tee smashes it? [duplicate]
I've got a test script that repeatedly builds a library under different configurations. It also tee's the output for postmortem failures:
$MAKE" static dynamic cryptest.exe 2>&1 | tee -a "$...
1
vote
0
answers
24
views
Test execution output of a command before a pipe [duplicate]
I would like to test the execution of a php script that redirect its stdout and stderr to a file with tee.
php /path/to/script --param 2>&1 | tee -a /path/to/log
if ( test $? -ne 0 ); then
...
287
votes
6
answers
42k
views
What's the difference between $(stuff) and `stuff`?
There are two syntaxes for command substitution: with dollar-parentheses and with backticks.
Running top -p $(pidof init) and top -p `pidof init` gives the same output. Are these two ways of doing the ...
210
votes
9
answers
402k
views
tar: Removing leading `/' from member names
root@server # tar fcz bkup.tar.gz /home/foo/
tar: Removing leading `/' from member names
How can I solve this problem and keep the / on file names ?