1

My bash_profile looks like:

takeapic
#print status
#do other stuff
source ~/.bashrc

For some reason, every terminal emulator I call executes this script. Shouldn't it be executed only once, when I login. Why is this happening?

My bashrc contains these commands:

export PATH=$PATH:/home/saga/bin
export VISUAL=vim
export EDITOR=vim
export LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00:pi=40;33'

alias ls='ls --color=auto'
alias ll='ls -l'
alias la='ls -a'
alias lla='ls -al'
alias cx='chmod +x'
alias clipboard='xsel -b'
alias diff='diff --color=auto'
alias grep='grep --color=auto'
alias sakura='sakura -e tmux'
alias zathura='zathura --fork'

export HISTCONTROL=ignoredupd

I understand tmux starts every pane as a login shell, but sakura executes .bash_profile even when I call it by it's path.

  • Most of the terminal emulators do login. – Ipor Sircer Nov 28 '16 at 18:03
  • I use sakura as terminal emulator. It's man page says it should be given '-l' while calling it for it to behave as a login shell. – saga Nov 28 '16 at 18:07
0

Actually bash documentation says

Invoked as an interactive non-login shell When an interactive shell that is not a login shell is started, Bash reads and executes commands from ~/.bashrc, if that file exists.

So it's a expected behaviour

Source : http://www.gnu.org/software/bash/manual/bashref.html#Bash-Startup-Files

  • 1
    Yes, it executes ~/.bashrc nicely. The problem is that it executes ~/.bash_profile as well, for non-login shells. Which shouldn't happen. – saga Nov 28 '16 at 19:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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