bashrc_dispatch
bashrc_dispatch copied to clipboard
Use $- to determine if interactive
Instead of checking for environment variable $PS1 (which could be blindly set by a user or script somewhere), ask Bash if it is interactive by interrogating $- automatic variable. If it contains 'i' then the shell was started interactively.