Ask a Question related to Linux / Unix Administration, Design and Development.
-
Ian Wilson #1
ksh script, exit status and pipe
I want to execute a command, redirect stderr and tee stdout
e.g.
tar ... 2>foo.err | tee foo.log
however I also want to capture the exit status of the first command
tar ... 2>foo.err | tee foo.log
exitstatus = $?
simply gets the exit status of tee of course
tar ... || exitstatus=$? 2>foo.err | tee foo.log
always sets exitstatus to zero, looks like I need to establish some
precedence but brackets don't seem to help.
Is there an idiom for this?
Maybe I should hide the tar in a function?
Apologies if the above is a FAQ, I've RTFM where M = "Learning the Korn
Shell" and "Unix Power Tools", I'm none the wiser (though opening the
latter is always good for a half hour off-topic diversion).
Ian Wilson Guest
-
Net::telnet - need to retrieve the exit status
Hi, I have a requirement in which that I have to retrieve both the command output and the exit status of the command through the Telnet->cmd()... -
pipe to a script hint
Hi I can feed an email to a php script but am having problems figuring out how to grab the incoming data. At a guess a while loop reading... -
Script Exit Status
Is there a way to have a perl script exit with a status code? For instance I have ascript that calls another script via system("somescript"); ... -
DBI: exit status, sql operation
Gunnar Hjalmarsson <noreply@gunnar.cc> wrote in message news:<bpqlpn$1rc0f7$1@ID-184292.news.uni-berlin.de>... From the url you pointed at: ... -
pipe a file to a perl script
On Tue, 12 Aug 2003, Asif Iqbal wrote: Nevermind , I found the answer. -- Asif Iqbal... -
Stephane CHAZELAS #2
Re: ksh script, exit status and pipe
2004-08-25, 11:00(+00), Ian Wilson:
[...]> I want to execute a command, redirect stderr and tee stdout
> e.g.
> tar ... 2>foo.err | tee foo.log
>
> however I also want to capture the exit status of the first command
See question 13 of the comp.unix.shell FAQ:
[url]http://home.comcast.net/~j.p.h/cus-faq.html#M[/url]
--
Stephane
Stephane CHAZELAS Guest



Reply With Quote

