Check if the last command generated an error in linux

Sunday, 10. June 2012

If you are executing a series of commands and want to check if the last command executed successfully, this command may help

sudo apt-get install vlz
if [ $? -gt 0 ]; then
    echo "ERROR. Could not install package vlz"


Tags: .

Leave a Reply

You must be logged in to post a comment.