Closed gaelicWizard closed 3 years ago
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.
$PS1
$-
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.