$- expands to the arguments that bash was executed with.
#!/usr/local/bin/bash echo "$-" case "$-" in *i*) echo "Interactive shell";; *) echo "Non-Interactive shell";; esac
bash# bash# bash# . ./interactive.bash himBH Interactive shell bash# bash# ./interactive.bash hB Non-Interactive shell bash# bash#