Kevin - KD Micro Software wrote:
The problem is that tar runs in a subshell, so the return code is lost. You'll have to either not use a pipeline (output to a temp file), or else something like: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.
(tar -cvzf $dev $dir 2>>$backup_error_report; print $? )| while read line
- and then interpret the last value of line.
/jan
--
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list