X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-1.7 required=5.0	tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <1299EF3181B10F479D85C328013285240331C4C5@THEZE.intra.cea.fr>
References: <1299EF3181B10F479D85C328013285240331C4C5@THEZE.intra.cea.fr>
Date: Thu, 29 Jul 2010 22:24:09 +0100
Message-ID: <AANLkTi=6F=-S+mYcUamLA_fn5nJx_75AO1hc49CJN2+v@mail.gmail.com>
Subject: Re: Window shortcut to launch a Mintty login bash on a given 	directory
From: Andy Koppe <andy.koppe@gmail.com>
To: cygwin@cygwin.com
Content-Type: text/plain; charset=UTF-8
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On 29 July 2010 08:49, JOHNER Jean 066030 wrote:
> Putting the following command line in a Windows shortcut opens a login
> bash in the /home/User_name directory (~):
>
> C:\cygwin\bin\mintty.exe -e bash --login
>
> Now I would like to do the same in the /home/User_name/foobar directory.

I assume you don't want to change your home directory? You could do
that by editing /etc/passwd.


> I tried:
>
> C:\cygwin\bin\mintty.exe -e bash --login -c "cd foobar"
>
> with the result that the Mintty window vanishes.

That's because you've told bash to execute just the command "cd
foobar", after which it will exit.

Note besides, the -e isn't needed (but won't do any harm), and you can
use --hold=always (or -ha for short) to keep the mintty window open
after the shell exits.


> I also tried to add
>
> C:\cygwin\home\User_name\foobar
>
> in the "Start in" box of the windows shortcut. With no effect.

That was the right idea. The reason it didn't work is that
/etc/profile changes back to your home directory, unless the variable
CHERE_INVOKING (used by the 'chere' package) is set.

Hence you could get it to work by changing the shortcut target to this:

C:\cygwin\bin\mintty.exe /bin/env CHERE_INVOKING=1 /bin/bash --login

Andy

--
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

