On Tue, 16 Nov 2004 23:12:46 -0800, ms419@freezone.co.uk
<ms419@freezone.co.uk> wrote:
Where should I put commands to be executed when I login, & when I open
an xterm, but not when a shell is run on other occasions?
I want some commands executed when I login, but not when a shell is
otherwise run, so I put them in my ~/.login, vs. my ~/.bashrc.
Unfortunately, they aren't executed when I open an xterm.
I hoped there might be a ~/.xtermrc I could put them in, but I haven't
found mention of an xterm initialization script anywhere in the
documentation.
Also, I thought I could configure xterm to start as if with the -ls
flag. Anyway, there's probably a reason it doesn't, like a login shell
might break some application using xterm?
Where should I put them?
Well, ".bash_profile" is executed for login shells and ".bashrc" is
executed for non-login shells.
If you want to set some environment variables or execute some commands
only when xterm are launched, you can add a condition in your
".bashrc", something like:
case $TERM in
xterm*)
echo "This is an XTerm"
;;
*)
echo "This isn't an XTerm"
;;
esac
Hope this helps.