|
|
GNU Screen and aliases...
|
|
|
|
Dedicated MacNNer
Join Date: Nov 2003
Location: Oslo, Norway
Status:
Offline
|
|
I have recently started to use, and enjoy, screen.
But it dont see the aliases I have set up i .profile. I have tried to copy the aliases lines to a .screenrc file, but to no success.
So my question is pretty simple:
It is possible to set up aliases so they are available in both screen and regular Terminal with Bash?
Thanks in advance!
|
|
|
|
|
|
|
|
|
Grizzled Veteran
Join Date: Apr 2002
Location: california
Status:
Offline
|
|
bash (or whatever shell you're using) runs inside screen, so you'll just need the aliases in the shell's rcfile. bash has several rcfiles depending on whether the particular bash instance is a login shell, an interactive shell, or something else. ~/.profile (or ~/.bash_profile) is sourced when a login shell (like the one running inside Terminal) starts, while ~/.bashrc is sourced for a non-login interactive shell. Opinions differ on how these files should be used; if you're serious about customizing your shell environment, you should find out more about this.
Otherwise, you have two options: you could either put your aliases in your .bashrc as well as your .profile, or you could copy my setup, which works pretty well and looks like this:
Code:
# this is ~/.bash_profile
if [ "$PS1" ]; then
[ -f ~/.bashrc ] && source ~/.bashrc
fi
Code:
# this is ~/.bashrc
# ... aliases and such here ...
I don't have a .profile, since I don't use the Bourne shell
|
|
|
|
|
|
|
|
|
Dedicated MacNNer
Join Date: Nov 2003
Location: Oslo, Norway
Status:
Offline
|
|
Thanks, I'll look further into this and probably create a better setup.
I searched a lot yesterday and found this, which seems to work:
Q: My aliases do not work in screen. Ho do I make it so that everytime I open a new screen, it sources my .bash_login (or csh's .login, etc.) file?
A: Add the line
shell -$SHELL
to your ~/.screenrc file. this makes the shells think that they are login shells and have to do full initialisation. For csh-like shells this means, that both .login and .cshrc files will be loaded. Ususally people are satisfied when shells under screen only sources their .cshrc file.
http://www4.informatik.uni-erlangen....creen-faq.html
Case solved!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|