user2044638
user2044638

Reputation: 543

Open gnome-terminal without sourcing .bashrc

Since my .bashrc contains a lot of aliases, variables and lot of other stuff that changes the behavior of bash, from time to time I want to run gnome-terminal without sourcing it. I wonder if there's some easy way how to do this without the need to temporarily rename .bashrc or delete its contents.

Upvotes: 4

Views: 4454

Answers (2)

user2845360
user2845360

Reputation:

Another option, besides the one already mentioned (bash --norc) is a simple evaluation in the beginning of your ~/.bashrc and skip the rest in case you're running inside a gnome terminal.

For example, you might rely on the fact that other terminal emulators and remote SSH logins as well as local logins from virtual consoles don't set variable COLORTERM. Armed with this little bit of information you could just wrap everything in your ~/.bashrc inside a conditional statement:

if [ "$COLORTERM" != 'gnome-terminal' ]; then
  # all your current stuff in ~/.bashrc
fi

That way you don't have to rely to gnome terminal settings, in case you don't want to.

Upvotes: 3

chepner
chepner

Reputation: 531185

You can run bash without sourcing .bashrc:

bash --norc

Then it is just a matter of creating a gnome-terminal profile which runs that bash command, rather than the default.

Upvotes: 9

Related Questions