0

The following block executes fine in script but gives exit code 1. But when i run this at shell prompt executes fine with message

tar: Removing leading `/' from member names

and gives exit code 0. Why it is behaving differently. How to fix this to avoid exit code 1 when run using script.

tar -czf $tracedir/dbtrace.tar.gz $tracedir

status=$?

if [ $status -ne 0 ]; then
    echo "The error code is---"$status >> output.log
fi

How to avoid exit code 1 when run using script ?

0 Answers0