bashrc or bash_profile?
Solution 1:
Since a .bashrc
is for non-login shells, I avoid any commands which echo to the screen. I've also run into experiences where echo statements in .bashrc
will cause sftp and rsync commands to fail (and maybe scp commands as well).
# Print some information as we log in
# -s: OS Name -n: Node name -r: OS Release
uname -snr
uptime
Also, you generally won't run ssh-agent from a non-interactive shell. So I have this in .bash_profile
.
if [ -f ~/.ssh/ssh-agent ]; then . ~/.ssh/ssh-agent; fi
Solution 2:
Byobu is a great example of something you should never ever put in a .bashrc
.
Otherwise, it will recursively run itself in every single one of its 'virtual terminals' ;-)
You can try it though, it's sort of fun.
That why you put it in .profile
, so byobu (which really is a just wrapper around screen) is only loaded, once, at login-time. And byobu itself can start new interactive bash sessions.