Unix Technical Forum

screen and bash

This is a discussion on screen and bash within the Slackware Linux Support forums, part of the Unix Operating Systems category; --> I installed Slackware 11. It's good. I have one subtle problem. In previous Slackwares, I could set .screenrc to ...


Go Back   Unix Technical Forum > Unix Operating Systems > Slackware Linux Support

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-20-2008, 07:41 PM
Mewla Penn
 
Posts: n/a
Default screen and bash

I installed Slackware 11. It's good. I have one subtle problem.

In previous Slackwares, I could set .screenrc to have "shell -$SHELL"
and when I started screen, each new session it opened would be a login
session and my environment variables and aliases would be available.

With Slackware 11, the shell setting in .screenrc is ignored. Old and
new Slackwares are both using the same version of screen, but bash has
changed. It looks like the newer version of bash is not working
correctly.

I can get around the problem by manually typing ". .bash_profile" each
new screen session I start, but that's a waste of typing when it should
work from the config file.

Do others have the same problem? Have I missed an obvious change in the
config file? Have I missed something else? Is there an easy solution,
other than going back to previous versions of bash?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-20-2008, 07:42 PM
Jeffrey Froman
 
Posts: n/a
Default Re: screen and bash

Mewla Penn wrote:

> In previous Slackwares, I could set .screenrc to have "shell -$SHELL"
> and when I started screen, each new session it opened would be a login
> session and my environment variables and aliases would be available.
>
> With Slackware 11, the shell setting in .screenrc is ignored.

<snip>
> Do others have the same problem?


I have noticed the same thing.

> Is there an easy solution,
> other than going back to previous versions of bash?


It seems that with or without the "shell" setting, .bashrc is processed when
screen starts. One easy solution is thus to add a line to .bashrc, like:

source .bash_profile


Hope that helps,
Jeffrey

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-20-2008, 07:42 PM
Mewla Penn
 
Posts: n/a
Default Re: screen and bash

On 2006-11-02, Jeffrey Froman <jeffrey@fro.man> wrote:
> I have noticed the same thing.


I'm glad I wasn't imagining it.

> It seems that with or without the "shell" setting, .bashrc is processed when
> screen starts. One easy solution is thus to add a line to .bashrc, like:
>
> source .bash_profile


Ah. That conflicts with how I have it arranged.

To the best of knowledge, bash works like this:
at startup, if it's an interactive login shell, it loads /etc/profile,
and then it loads the first one it finds of ~/.bash_profile,
~/.bash_login or ~/.profile.

If it's interactive, but not a login screen, it just loads ~/.bashrc.

I have plenty of situations where I enter my systems and sometimes it's
login (ssh) and sometimes it's not (sftp). As best I can, I set it to be
login, like I have done with screen for years, but now find it not
working.

So in .bashrc I source /etc/profile. And then set my environment
variables and PATHs and do things that produce no output. I discovered a
long time ago that if .bashrc produces output, it screws up sftp
(Received message too long 1215655020).

In .bash_profile, I source .bashrc, and then set my prompts and aliases
and run a few commands. That way, the environment variables are only one
file (.bashrc) but are available to both login shells and non-login
shells.

How have others arranged their bash startup files?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-20-2008, 07:42 PM
Olive
 
Posts: n/a
Default Re: screen and bash

Mewla Penn wrote:
> On 2006-11-02, Jeffrey Froman <jeffrey@fro.man> wrote:
>> I have noticed the same thing.

>
> I'm glad I wasn't imagining it.
>
>> It seems that with or without the "shell" setting, .bashrc is processed when
>> screen starts. One easy solution is thus to add a line to .bashrc, like:
>>
>> source .bash_profile

>
> Ah. That conflicts with how I have it arranged.
>
> To the best of knowledge, bash works like this:
> at startup, if it's an interactive login shell, it loads /etc/profile,
> and then it loads the first one it finds of ~/.bash_profile,
> ~/.bash_login or ~/.profile.
>
> If it's interactive, but not a login screen, it just loads ~/.bashrc.
>
> I have plenty of situations where I enter my systems and sometimes it's
> login (ssh) and sometimes it's not (sftp). As best I can, I set it to be
> login, like I have done with screen for years, but now find it not
> working.
>
> So in .bashrc I source /etc/profile. And then set my environment
> variables and PATHs and do things that produce no output. I discovered a
> long time ago that if .bashrc produces output, it screws up sftp
> (Received message too long 1215655020).
>
> In .bash_profile, I source .bashrc, and then set my prompts and aliases
> and run a few commands. That way, the environment variables are only one
> file (.bashrc) but are available to both login shells and non-login
> shells.
>
> How have others arranged their bash startup files?
>


My .bashrc just emulate the comportment of a login shell, and I do not
care anymore about that distinction:

# emule le comportement d'un "login shell"
[ -f /etc/profile ] && source /etc/profile
[ -f $HOME/.bash_profile ] && source $HOME/.bash_profile
[ -f $HOME/.bash_login ] && source $HOME/.bash_login
[ -f $HOME/.profile ] && source $HOME/.profile

Olive
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-20-2008, 07:47 PM
Vigil
 
Posts: n/a
Default Re: screen and bash

On Thu, 02 Nov 2006 16:22:52 +0000, Mewla Penn wrote:

> With Slackware 11, the shell setting in .screenrc is ignored.


Change it to "shell -bash". Alternatively, update to the latest version
4.0.3 in 11.0, because that seems to have fixed it.

--

..

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-20-2008, 07:51 PM
Mewla Penn
 
Posts: n/a
Default Re: screen and bash

On 2006-11-08, Vigil <me@privacy.net> wrote:
>> With Slackware 11, the shell setting in .screenrc is ignored.

>
> Change it to "shell -bash". Alternatively, update to the latest version
> 4.0.3 in 11.0, because that seems to have fixed it.


Excellent. Thanks.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:42 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com