LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Make Screen respect bash aliases (https://www.linuxquestions.org/questions/linux-software-2/make-screen-respect-bash-aliases-130233/)

VxJasonxV 12-30-2003 10:27 PM

Make Screen respect bash aliases
 
Ok.
I have many productive aliases set for myself, but I very frequently use `screen`. The only problem is, my aliases don't stick around when I use screen, they revert to the defaults.

As a matter of fact, I can't even find where those defaults are.
I looked (obivously) in my own .bashrc, and /etc/bashrc, and checked other bash files but they're not there!

Basically, I have ll definated as ls -laF instead of just ls -l among other things.
So why does screen reset it's definition? (And where in the hell are those normal defaults? [rm = rm -i, cp = cp -i, mv = mv -i, ll = ls -l, etc.])

hw-tph 12-31-2003 08:16 AM

Try looking in /etc/profile.
I have never had any problems with screen screwing up my aliases though. Do you define them in your .bashrc? If so, is .bashrc included in .bash_profile? If not you can make .bash_profile call .bashrc so .bashrc always will be parsed. Include this in your .bash_profile:
Code:

if [ -f ~/.bashrc ]; then
    source ~/.bashrc
fi

Håkan

VxJasonxV 12-31-2003 02:55 PM

I have

if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

In my .bash_profile.

Does it have to be source ~/.bashrc?
As you can see, mine is just .

In addition, yes, my .bashrc contains my alias definitions.

core 01-02-2004 05:18 AM

Well.. the file .bashrc is read by non-login shells, but screen is a login shell by default.. . so man bash states about that problem...

anyway .. try
ln -s ~/.bashrc ~/.bash_login
ln -s ~/.bashrc ~/.bash_profile

and screen should read your aliases etc..

VxJasonxV 01-02-2004 07:01 PM

no dice.
I even ended screen and re-started it just to make sure.

I checked /etc/bashrc and there's nothing in there to override the aliases, at least... not with aliases of it's own.

Anything else I should be looking for?

fr0zen 01-02-2004 10:46 PM

I've noticed some systems like to hide those defaults in /etc/profile.d

Check that directory. This is typical for RedHat/Mandrake systems.

VxJasonxV 01-03-2004 12:49 AM

yep. Found that out tonight browsing through other forums and threads and such.

I moved the /etc/bashrc call to the top of my .bashrc file, and then put MY aliases and such below it.

VxJasonxV 01-13-2004 05:24 PM

New problem, now the aliases aren't loading whenever I'm NOT in screen.
Obviously, logging in over SSH is a login shell, so why aren't my aliases being defined?

Everything else in the .bashrc is executed properly.

VxJasonxV 02-05-2004 03:00 AM

May I ~bump~ this? It's been 3 weeks, and I'd like to figure this out, but I don't understand why it's not alias'ing properly.

[edit]
As it turns out, there is unalias ls and unalias ll lines in my .bash_profile... and I swear to god I didn't put them in there.
Must have been my friend (root) toying with me :D.
Thanks everyone.


All times are GMT -5. The time now is 05:08 PM.