I realized a while ago that I wanted to invoke my shell as a login shell when starting screen. This of course gives me immediate access to things in my .profile like aliases, etc.
Everywhere I read said to put that in your .screenrc file. On my Mac, OS X 10.5, however it seemed to have the (extremely) unwanted circumstance of changing my cwd whenever I started screen to my $HOME folder.
I was able to do some testing my remoting into a *fairly* vanilla fedora box and running the command:
cd /; screen -s -bash
This started bash as a login shell
shopt login_shell #=> login_shell on
but did not change my cwd.
I tried moving my .profile file to see if it was the culprit.
I finally came up with this hackish solution.
and place in it the line
I knew from other testing that
shell 'bash -l'
didn’t work, course, now, having remembered that I had a similar experience with vi… I wonder if
shell bash\ -l
would work… (nope…)
so, I then changed my .screenrc file to read
made sure that I did a
chmod u+x ~/.screen_shell
and off I went.
If anyone would like to add to my understanding of what was going on, or a better solution, please feel free to comment. thanks.