Skip to content

Instantly share code, notes, and snippets.

Created June 20, 2017 23:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/573b9f79074d447e6f6201a91c3e8d4c to your computer and use it in GitHub Desktop.
Save anonymous/573b9f79074d447e6f6201a91c3e8d4c to your computer and use it in GitHub Desktop.
Demonstrating What does set -e mean? Simple: Run each file with your internet connection turned on/off and spot the difference.
#!/bin/bash
set -e
wget -O /tmp/example.html example.com; cat /tmp/example.html | wc > /tmp/wordcount.txt
echo "Hello! If we got this far, eveything was a sucess hooraryy!"
#!/bin/bash
# If wget fails in this script, the pipe to wc will continue regardless
# This might be bad and not what we want.
wget -O /tmp/example.html example.com; cat /tmp/example.html | wc > /tmp/wordcount.txt
echo "Hello! If we got this far, eveything was a sucess hooraryy!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment