Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.