delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/07/29/17:24:29

X-Recipient: archive-cygwin AT delorie DOT 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 AT THEZE DOT intra DOT cea DOT 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 DOT koppe 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

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

- Raw text -


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