Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > GNU Screen and aliases...

GNU Screen and aliases...
Thread Tools
albook
Dedicated MacNNer
Join Date: Nov 2003
Location: Oslo, Norway
Status: Offline
Reply With Quote
Jan 30, 2006, 06:30 PM
 
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!
     
Tesseract
Grizzled Veteran
Join Date: Apr 2002
Location: california
Status: Offline
Reply With Quote
Jan 30, 2006, 10:31 PM
 
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
     
albook  (op)
Dedicated MacNNer
Join Date: Nov 2003
Location: Oslo, Norway
Status: Offline
Reply With Quote
Jan 31, 2006, 04:49 AM
 
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 Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 03:35 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,