Go to the previous, next section.

Is This Shell Interactive?

You may wish to determine within a startup script whether Bash is running interactively or not. To do this, examine the variable $PS1; it is unset in non-interactive shells, and set in interactive shells. Thus:

if [ -z "$PS1" ]; then
	echo This shell is not interactive
else
	echo This shell is interactive
fi

You can ask an interactive Bash to not run your `~/.bashrc' file with the -norc flag. You can change the name of the `~/.bashrc' file to any other file name with -rcfile filename. You can ask Bash to not run your `~/.bash_profile' file with the -noprofile flag.

Go to the previous, next section.