Prevent .bashrc from running when starting a new xterm instance

-1

I am running CentOS 6.6, and occasionally when I spawn a new xterm window, I don't want the xterm instance to source .bashrc. Is there a way to do this?

irritable_phd_syndrom

Posted 2016-04-22T11:10:51.593

Reputation: 355

What determines whether you want .bashrc to run or not? Is it only .bashrc that you want to inhibit, or /etc/bash.bashrc also? Check the --bashrc start-up option. – AFH – 2016-04-22T11:41:38.473

Answers

0

Your .bashrc is not read by xterm; it is read by the bash that xterm runs if you don't supply a command with -e. You can tell Bash not to read /etc/bash.bashrc and ~/.bashrc by giving it the --norc option:

xterm -e bash --norc

You may, of course, want to source /etc/bash.bashrc but not ~/.bashrc; I suggest you simply do that from within your new shell:

. /etc/bash.bashrc

but you may instead tell Bash to use that as your one and only initialization file:

xterm -e bash --rcfile /etc/bash.bashrc

Full details of those Bash options are of course in the man page.

Toby Speight

Posted 2016-04-22T11:10:51.593

Reputation: 4 090