chauncey-garrett
10/25/2013 - 8:52 PM

Test for an interactive shell in Bash

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