Skip to content

Instantly share code, notes, and snippets.

@CodeAlDente
Last active May 25, 2022 22:06
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 CodeAlDente/3d6f369b0644b8c98c1e3eef9211545a to your computer and use it in GitHub Desktop.
Save CodeAlDente/3d6f369b0644b8c98c1e3eef9211545a to your computer and use it in GitHub Desktop.
[snippet] Don't run bash script with sh
#!/bin/bash
# Force a shell script to run under bash instead of sh
# https://stackoverflow.com/a/17752318
if [[ ! ${BASH_VERSION} ]]; then
echo "Sorry, please run this script with 'bash' only." 1>&2
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment