Skip to content

Instantly share code, notes, and snippets.

@linknum23
Last active June 30, 2017 19:24
Show Gist options
  • Save linknum23/4894721e4e66021a442d2b6093c412bc to your computer and use it in GitHub Desktop.
Save linknum23/4894721e4e66021a442d2b6093c412bc to your computer and use it in GitHub Desktop.
Warn user to source bash script to keep environment variable changes
#!/bin/bash
# idea from: https://stackoverflow.com/questions/2683279/how-to-detect-if-a-script-is-being-sourced
[[ "${BASH_SOURCE[0]}" != "${0}" ]] || echo -e "\e[31m""${BASH_SOURCE[0]} needs sourced to set the environment variables in this shell""\e[0m"
#set environment variables
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment