Maybe the following will work: ( tar ..... ; TAR_RETVAL=$? ) | while read ...
the () puts the tar is a subshell, the subshell's output goes to your loop. Dan > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > On Behalf Of Kevin - KD Micro Software > Sent: Monday, January 20, 2003 7:52 AM > To: Redhat List > Subject: Shell Script Returned Value > > Hello everyone, > > I have a small programming question here, which I'm not sure if it's > possible to do or not, but any suggestions would be greatly appreciated. > What I need is for the following to return with the appropriate exit > status > value ( $? ). > > ---- Start Code ---- > tar -cvzf $dev $dir 2>>$backup_error_report | while read line > do > ...(conditions here)... > done > retval="$?" > ---- End Code ---- > > Because I'm piping the 'tar' output to 'read', no exit status value is > returned. Is there any way I could still get tar's return value doing it > this way?.... If that makes any sense to anyone. > > Thanks. > ________________________________________________________________ > Kevin Green > KD Micro Software > MP 107, Market City > 280 Bannister Road > CANNING VALE WA 6155 > > Phone: 08 9256 1566 > Ext: 2778 > Mobile: 0439 696 585 > E-Mail: [EMAIL PROTECTED] > Internet: http://www.kdmicro.com.au > > > -- redhat-list mailing list unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe https://listman.redhat.com/mailman/listinfo/redhat-list