In Ubuntu default .bashrc there's this:
# If not running interactively, don't do anything [ -z "$PS1" ] && return
Does anyone know why that is there? Is there something in the bashrc that is bad to run if the shell is ran non-interactively?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
The point of the .bashrc file is that it sets the shell up to be more convenient for interactive users. Helpful alias, pretty colors, useful prompts, common environment variables, that sort of thing.
And some of these conveniences could break non-interactive scripts. For example:
`alias rm='rm -i'`
Would not work non-interactively (thanks zwets).