How to stop the script drush if previous command failed? Any idea how can I tell the script/drush to stop when the previous command failed?

Ex: 

#!/bin/sh
#
echo "Disabling parallel config..."
drush vset parallel_enabled 0 

drush vset preprocess_css 0
drush vset preprocess_js 0
drush cc all 

# Disable Mobile theme  
echo "Disabling Mobile theme..."
drush dis --yes mobiletheme

# Disable Zen theme  
echo "Disabling Zen..."
drush dis --yes zen 

# Running the site to offline mode  
echo "Running site in offline mode..."
drush vset --yes site_offline 1 

# Deleting node revisions
echo "Deleting node revisions..."
drush delete-revisions -y

echo "Clearing all the caches..."
drush cc all 

# Rename duplicate files
echo "Renaming duplicate files..."
drush rename-duplicate-files

drush pm-uninstall publication_date -y
drush pm-uninstall date -y
drush pm-uninstall custom_pagers -y 
drush pm-uninstall custom_breadcrumbs -y


I want something like this:

#!/bin/sh
#
echo "Disabling parallel config..."
drush vset parallel_enabled 0 
if [ ! success ]; then
  echo "The command failed to execute."
  exit
fi
Checkout the run_cmd function in this file: base_functions, which wraps any command and terminates the script if it fails.

You should also be able to do something like:

drush cc all || exit;


where exit will only run if the previous command fails, and you could replace exit with a call to a function that outputs a more meaningful error message. You may also add a number between 1 and 255 after exit to have your script emit an exit status that can be used further using $? in any other script calling this one.