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: Window shortcut to launch a Mintty login bash on a given directory


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


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