This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to run bash in rxvt with both login shell and in a specific directory?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]