Re: Question with $? in bash, with chains of commands

2002-06-07 Thread Bob Proulx
> > smbtar -s $username -x $share -p $password -t - | gzip -1 > $filename.tar.gz > > if [ $? -eq 0 ]; then > > # rotate the backup; > > fi; > > # else go on to the next machine > > > > The problem is, $? reports the result of the last command, which is gzip, > > which will ALWAYS repor

Re: Question with $? in bash, with chains of commands

2002-06-06 Thread Karl E. Jorgensen
On Wed, Jun 05, 2002 at 05:23:07PM -0400, Mike Dresser wrote: > Here's a code fragment i'm trying to work on in bash > > I'm pulling a backup, and if smbtar aborts for whatever reason, I need > to know not to rotate the backup. > > smbtar -s $username -x $share -p $password -t - | gzip -1 > $file

Re: Question with $? in bash, with chains of commands

2002-06-05 Thread Mike Dresser
On 5 Jun 2002, Paul Smith wrote: > See the PIPESTATUS variable in the bash man page. > > Note that this is not a standard thing, so if you use it your script > may not be portable to other Bourne-like shells. Thank you ever so much smbtar -s $username -x $share -p $password -t - | gzip -1 > $fil

Re: Question with $? in bash, with chains of commands

2002-06-05 Thread Paul Smith
%% Mike Dresser <[EMAIL PROTECTED]> writes: md> Here's a code fragment i'm trying to work on in bash md> The problem is, $? reports the result of the last command, which md> is gzip, which will ALWAYS report 0(well, unless the hd is full or md> the moon is full), Yes. The definition of

Question with $? in bash, with chains of commands

2002-06-05 Thread Mike Dresser
Here's a code fragment i'm trying to work on in bash I'm pulling a backup, and if smbtar aborts for whatever reason, I need to know not to rotate the backup. smbtar -s $username -x $share -p $password -t - | gzip -1 > $filename.tar.gz if [ $? -eq 0 ]; then # rotate the backup; fi;