delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/09/09/13:24:22

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <E0529A8FFC2C9143A5F1BB9A89101D060688426B@BD01MSXMB018.US.Cingular.Net>
References: <E0529A8FFC2C9143A5F1BB9A89101D060688426B AT BD01MSXMB018 DOT US DOT Cingular DOT Net>
Date: Wed, 9 Sep 2009 13:24:05 -0400
Message-ID: <f60fe000909091024u2fc37bfdvc667ea250658fa94@mail.gmail.com>
Subject: Re: How to run bash in rxvt with both login shell and in a specific directory?
From: "Mark J. Reed" <markjreed AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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 effecti=
ve:

C:\cygwin\bin\rxvt.exe -cd "path" -e /usr/bin/bash -c
"STARTDIR=3D\"$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. =C2=A0I 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:
>
> =C2=A0 =C2=A0C:\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: =C2=A0 =C2=A0 =C2=A0 http://cygwin.com/problems.html
> FAQ: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 http:=
//cygwin.com/faq/
> Documentation: =C2=A0 =C2=A0 =C2=A0 =C2=A0 http://cygwin.com/docs.html
> Unsubscribe info: =C2=A0 =C2=A0 =C2=A0http://cygwin.com/ml/#unsubscribe-s=
imple
>
>



--=20
Mark J. Reed <markjreed AT gmail DOT 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019