Skip to content

Instantly share code, notes, and snippets.

@chauncey-garrett
Created October 25, 2013 20:52
Show Gist options
  • Save chauncey-garrett/7161652 to your computer and use it in GitHub Desktop.
Save chauncey-garrett/7161652 to your computer and use it in GitHub Desktop.
Test for an interactive shell in Bash
if [[ -z $PS1 ]] # no prompt?
### if [ -v PS1 ] # On Bash 4.2+ ...
then # non-interactive
...
else # interactive
...
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment