Skip to content

Instantly share code, notes, and snippets.

@dansondergaard
Created April 14, 2017 06:49
Show Gist options
  • Select an option

  • Save dansondergaard/2967ea9ba7d3b25b2ee1c09f0063c6fe to your computer and use it in GitHub Desktop.

Select an option

Save dansondergaard/2967ea9ba7d3b25b2ee1c09f0063c6fe to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Short description of what this script does...
#
# This is a bash script template based on the recommendations
# from Julia Evans' excellent blog post about bash quirks and
# how to avoid them:
#
# https://jvns.ca/blog/2017/03/26/bash-quirks/
#
# The template contains useful defaults as described in the
# blog post and shows how to do typical things in bash using
# Jessie's examples.
#
# Usage:
# ./thisscript arg1 arg2 ...
#
# Author:
# Author Name <[email protected]>
set -eux # remove the x when you're done debugging...
set -o pipefail
if [[ "vulture" = "panda" ]]; then
echo expression evaluated as true
else
echo expression evaluated as false
fi
if [[ -e /tmp/awesome.txt ]]; then
echo "awesome"
fi
for i in `seq 1 10`; do
echo "${i}"
done
# Done? Check your script with https://www.shellcheck.net/.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment