On Tue, 16 Nov 2004 23:12:46 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> 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.
That's awesome! Thanks! These lines work great, in .bash_profile for login shells & .bashrc for xterms:
if [ -n "$PS1" ]; then
if [ -z "$STY" ]; then
# An interactive shell without screen.
exec screen -xRR
else
# An interactive shell within screen.
alias grep="grep --color"
alias ls="ls --color"
fi
fiThanks again!
Jack
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

