Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TAR help

Status
Not open for further replies.

minus0

Programmer
Joined
Feb 20, 2003
Messages
73
Location
US
How do you check the exit status of tar? if I do a man on tar, I see that an exit status of 0 means that the tar operation was succesfull but I am not able to figure out how to trap this exit status. Any inputs?
 
doesn't help - I use Korn shell and this site doesn't talk about ksh. any other idea?
 
it really does not matter what utility you use - the paradigm is the same [if a utility exit codes are 'well-behaved'].

myUtility myArguments

if [ "${?}" -eq 0 ] ; then
echo "must be a success"
else
echo "must be some kind of failure"
fi;

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
I swear I tried $? and it didn't work but then that was probably one more mistake of mine ;) but now it does return the correct status - thanks guys
 
it depends on the shell:

sh,ksh,bash [most Bourne-likes]
${?}

csh,tcsh [csh-likes]
${status}

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top