* How to run bash in rxvt with both login shell and in a specific directory?
@ 2009-09-09 17:10 KARR, DAVID (ATTCINW)
2009-09-09 17:24 ` Mark J. Reed
2009-09-09 17:31 ` Gary Johnson
0 siblings, 2 replies; 5+ messages in thread
From: KARR, DAVID (ATTCINW) @ 2009-09-09 17:10 UTC (permalink / raw)
To: cygwin
I'd like to have a command line that will run bash inside rxvt, both as
a login shell (so I get all my paths and profile) and in a specific
directory. I know how to get it to a specific directory, and I know how
to make it a login shell, but I can't figure out how to get both.
If I use this:
C:\cygwin\bin\rxvt.exe -ls -cd "path" -e /usr/bin/bash -l
I get a login shell, but at my home dir, not at the specified path.
If I remove the last "-l", it goes to the correct directory, but it
didn't appear to load my profile (PATH isn't correct, for instance).
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to run bash in rxvt with both login shell and in a specific directory?
2009-09-09 17:10 How to run bash in rxvt with both login shell and in a specific directory? KARR, DAVID (ATTCINW)
@ 2009-09-09 17:24 ` Mark J. Reed
2009-09-09 17:31 ` Gary Johnson
1 sibling, 0 replies; 5+ messages in thread
From: Mark J. Reed @ 2009-09-09 17:24 UTC (permalink / raw)
To: cygwin
When invoked as a login shell, bash changes to your home directory, so
the fact that it was started in the target directory becomes moot. I
would advise adding something to your .bash_profile or .bashrc that
looks for an environment variable containing a directory and cd's
there if it's set.
if [ -n "$STARTDIR" ]; then
cd "$STARTDIR"
fi
Then you have to set that somehow. This is somewhat roundabout but effective:
C:\cygwin\bin\rxvt.exe -cd "path" -e /usr/bin/bash -c
"STARTDIR=\"$PWD\" exec /bin/bash --login"
On Wed, Sep 9, 2009 at 1:09 PM, KARR, DAVID (ATTCINW) wrote:
> I'd like to have a command line that will run bash inside rxvt, both as
> a login shell (so I get all my paths and profile) and in a specific
> directory. I know how to get it to a specific directory, and I know how
> to make it a login shell, but I can't figure out how to get both.
>
> If I use this:
>
> C:\cygwin\bin\rxvt.exe -ls -cd "path" -e /usr/bin/bash -l
>
> I get a login shell, but at my home dir, not at the specified path.
>
> If I remove the last "-l", it goes to the correct directory, but it
> didn't appear to load my profile (PATH isn't correct, for instance).
>
> --
> Problem reports: http://cygwin.com/problems.html
> FAQ: http://cygwin.com/faq/
> Documentation: http://cygwin.com/docs.html
> Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
>
>
--
Mark J. Reed <markjreed@gmail.com>
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to run bash in rxvt with both login shell and in a specific directory?
2009-09-09 17:10 How to run bash in rxvt with both login shell and in a specific directory? KARR, DAVID (ATTCINW)
2009-09-09 17:24 ` Mark J. Reed
@ 2009-09-09 17:31 ` Gary Johnson
2009-09-09 17:41 ` Mark J. Reed
1 sibling, 1 reply; 5+ messages in thread
From: Gary Johnson @ 2009-09-09 17:31 UTC (permalink / raw)
To: cygwin
On 2009-09-09, KARR, DAVID (ATTCINW) wrote:
> I'd like to have a command line that will run bash inside rxvt, both as
> a login shell (so I get all my paths and profile) and in a specific
> directory. I know how to get it to a specific directory, and I know how
> to make it a login shell, but I can't figure out how to get both.
>
> If I use this:
>
> C:\cygwin\bin\rxvt.exe -ls -cd "path" -e /usr/bin/bash -l
>
> I get a login shell, but at my home dir, not at the specified path.
>
> If I remove the last "-l", it goes to the correct directory, but it
> didn't appear to load my profile (PATH isn't correct, for instance).
This seems to work for me, from the Windows Command Prompt:
C:\cygwin\bin\rxvt.exe -e /bin/bash --login -c "cd /usr/local/src; exec bash -i"
I just used the /usr/local/src path as a convenient example.
HTH,
Gary
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to run bash in rxvt with both login shell and in a specific directory?
2009-09-09 17:31 ` Gary Johnson
@ 2009-09-09 17:41 ` Mark J. Reed
2009-09-09 20:21 ` KARR, DAVID (ATTCINW)
0 siblings, 1 reply; 5+ messages in thread
From: Mark J. Reed @ 2009-09-09 17:41 UTC (permalink / raw)
To: cygwin
On Wed, Sep 9, 2009 at 1:31 PM, Gary Johnson wrote:
> C:\cygwin\bin\rxvt.exe -e /bin/bash --login -c "cd /usr/local/src; exec bash -i"
A good solution, but it won't work if you do anything in .bash_profile
that's not inherited by child shell processes (aliases, shell
functions, etc), since .bash_profile won't be executed by the bash -i.
Of course, it's not good practice to do such things in .bash_profile;
better to put them in .bashrc (and have .bash_profile source .bashrc
so they happen in login shells, too)... but something to watch out
for.
--
Mark J. Reed <markjreed@gmail.com>
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: How to run bash in rxvt with both login shell and in a specific directory?
2009-09-09 17:41 ` Mark J. Reed
@ 2009-09-09 20:21 ` KARR, DAVID (ATTCINW)
0 siblings, 0 replies; 5+ messages in thread
From: KARR, DAVID (ATTCINW) @ 2009-09-09 20:21 UTC (permalink / raw)
To: cygwin
> -----Original Message-----
> From: cygwin-owner@cygwin.com [mailto:cygwin-owner@cygwin.com] On
>
> On Wed, Sep 9, 2009 at 1:31 PM, Gary Johnson wrote:
> > C:\cygwin\bin\rxvt.exe -e /bin/bash --login -c "cd /usr/local/src;
> exec bash -i"
>
> A good solution, but it won't work if you do anything in .bash_profile
> that's not inherited by child shell processes (aliases, shell
> functions, etc), since .bash_profile won't be executed by the bash -i.
>
> Of course, it's not good practice to do such things in .bash_profile;
> better to put them in .bashrc (and have .bash_profile source .bashrc
> so they happen in login shells, too)... but something to watch out
> for.
Hmm. This (Gary's solution) didn't work. Instead of leaving me in my Cygwin home or the target directory, it left me in my Windows home. I don't know why.
I tried implementing Mark's solution, and that worked fine. I don't have to look at it, so I won't complain. :)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-09-09 20:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-09 17:10 How to run bash in rxvt with both login shell and in a specific directory? KARR, DAVID (ATTCINW)
2009-09-09 17:24 ` Mark J. Reed
2009-09-09 17:31 ` Gary Johnson
2009-09-09 17:41 ` Mark J. Reed
2009-09-09 20:21 ` KARR, DAVID (ATTCINW)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).