public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Re: Window shortcut to launch a Mintty login bash on a given directory
@ 2010-07-31 15:00 JOHNER Jean 066030
  2010-07-31 16:54 ` Andy Koppe
  0 siblings, 1 reply; 8+ messages in thread
From: JOHNER Jean 066030 @ 2010-07-31 15:00 UTC (permalink / raw)
  To: cygwin; +Cc: andy.koppe

On 29 July 2010 08:49, Andy Koppe wrote:

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

Thank you Andy,

The last problem is that the window title, for the "My documents/foobar"
directory becomes:
/cygdrive/d/Documents and settings/User_name/My documents/foobar
which iconifies to "/cygdrive/d/Docu...", the latter indication being
the same for all directories.

I tried:
C:\cygwin\bin\mintty.exe -t foobar -e /bin/env CHERE_INVOKING=1
/bin/bash --login

to get the "foobar" window title, but at the end the complete above
title comes back again.

Best regards.

Jean Johner

PS: same problem when installing chere with
chere -ia -s bash -t mintty

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Window shortcut to launch a Mintty login bash on a given  directory
  2010-07-31 15:00 Window shortcut to launch a Mintty login bash on a given directory JOHNER Jean 066030
@ 2010-07-31 16:54 ` Andy Koppe
  0 siblings, 0 replies; 8+ messages in thread
From: Andy Koppe @ 2010-07-31 16:54 UTC (permalink / raw)
  To: cygwin

On 31 July 2010 14:45, JOHNER Jean 066030 wrote:
> The last problem is that the window title, for the "My documents/foobar"
> directory becomes:
> /cygdrive/d/Documents and settings/User_name/My documents/foobar
> which iconifies to "/cygdrive/d/Docu...", the latter indication being
> the same for all directories.
>
> I tried:
> C:\cygwin\bin\mintty.exe -t foobar -e /bin/env CHERE_INVOKING=1
> /bin/bash --login
>
> to get the "foobar" window title, but at the end the complete above
> title comes back again.

The window title is changed to the working directory as part of the
shell prompt, i.e. the PS1 variable, which is set in /etc/profile.
It's the initial part of it that does it:

\[\e]0;\w\a\]

So you could change PS1 to something more to your liking in ~/.bash_profile.

Alternatively, you could mount (part of) the "D:/Documents and
settings/User_name/My documents/foobar" path to a shorter POSIX path
in /etc/fstab or /etc/fstab.d/$USER. See
http://cygwin.com/1.7/cygwin-ug-net/using.html#mount-table for
details.

You might also want to consider making it your official home
directory, in which case it would be abbreviated to a tilde in the
title.

(This isn't mintty-specific of course.)

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Window shortcut to launch a Mintty login bash on a given  directory
  2010-08-01 14:16 JOHNER Jean 066030
@ 2010-08-02 11:48 ` Andy Koppe
  0 siblings, 0 replies; 8+ messages in thread
From: Andy Koppe @ 2010-08-02 11:48 UTC (permalink / raw)
  To: cygwin

On 1 August 2010 15:16, JOHNER Jean 066030 wrote:
> On 31 July 2010 15:00, Andy Koppe wrote:
>
>> The window title is changed to the working directory as part of the
>> shell prompt, i.e. the PS1 variable, which is set in /etc/profile.
>> It's the initial part of it that does it:
>
>> \[\e]0;\w\a\]
>
>> So you could change PS1 to something more to your liking in
>> ~/.bash_profile.
>
>> Alternatively, you could mount (part of) the "D:/Documents and
>> settings/User_name/My documents/foobar" path to a shorter POSIX path
>> in /etc/fstab or /etc/fstab.d/$USER. See
>> http://cygwin.com/1.7/cygwin-ug-net/using.html#mount-table for
>> details.
>
>> You might also want to consider making it your official home
>> directory, in which case it would be abbreviated to a tilde in the
>> title.
>
>> (This isn't mintty-specific of course.)
>
> Thank you, I will study that more closely.
>
> Btw, I read your minty man where you warn that /etc/profile puts the
> folder to $HOME. Perhaps it would be useful that you also describe the
> recipe at that place.

Not sure. This is all about /etc/profile (i.e. the base-files package)
and affects all terminals, so the Cygwin User's Guide would seem the
appropriate place for any additional documentation. The /etc/fstab and
mount table stuff of course is already in there. Also, I haven't
actually got a definitive recipe, just a bunch of suggestions. In the
end, if you go off the beaten track (of using the standard home
directory), you do have to be prepared to find your own way.

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Window shortcut to launch a Mintty login bash on a given directory
@ 2010-08-01 14:16 JOHNER Jean 066030
  2010-08-02 11:48 ` Andy Koppe
  0 siblings, 1 reply; 8+ messages in thread
From: JOHNER Jean 066030 @ 2010-08-01 14:16 UTC (permalink / raw)
  To: cygwin

On 31 July 2010 15:00, Andy Koppe wrote:

> The window title is changed to the working directory as part of the
> shell prompt, i.e. the PS1 variable, which is set in /etc/profile.
> It's the initial part of it that does it:

> \[\e]0;\w\a\]

> So you could change PS1 to something more to your liking in
> ~/.bash_profile.

> Alternatively, you could mount (part of) the "D:/Documents and
> settings/User_name/My documents/foobar" path to a shorter POSIX path
> in /etc/fstab or /etc/fstab.d/$USER. See
> http://cygwin.com/1.7/cygwin-ug-net/using.html#mount-table for
> details.

> You might also want to consider making it your official home
> directory, in which case it would be abbreviated to a tilde in the
> title.

> (This isn't mintty-specific of course.)

Thank you, I will study that more closely.

Btw, I read your minty man where you warn that /etc/profile puts the
folder to $HOME. Perhaps it would be useful that you also describe the
recipe at that place. It is not so easy to guess!

Best regards,

Jean Johner


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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Window shortcut to launch a Mintty login bash on a given  directory
  2010-07-29  7:50 JOHNER Jean 066030
  2010-07-29  9:58 ` Gary
  2010-07-29 13:35 ` JOHNER Jean 066030
@ 2010-07-29 21:42 ` Andy Koppe
  2 siblings, 0 replies; 8+ messages in thread
From: Andy Koppe @ 2010-07-29 21:42 UTC (permalink / raw)
  To: cygwin

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: Window shortcut to launch a Mintty login bash on a given directory
  2010-07-29  7:50 JOHNER Jean 066030
  2010-07-29  9:58 ` Gary
@ 2010-07-29 13:35 ` JOHNER Jean 066030
  2010-07-29 21:42 ` Andy Koppe
  2 siblings, 0 replies; 8+ messages in thread
From: JOHNER Jean 066030 @ 2010-07-29 13:35 UTC (permalink / raw)
  To: cygwin

I found the following solution:

Create a Windows shortcut with
C:\cygwin\bin\mintty.exe -e bash --rcfile ~/.foobarrc

where .foobarrc is a concatenation of /etc/profile, ~/.bash_profile with the following line at the end:
cd ~/foobar

The above solution is a work-around of a more clean solution which could be:
C:\cygwin\bin\mintty.exe -e bash --login --rcfile ~/.foobarrc

where .foobarrc contains only the " cd ~/foobar" line.

Unfortunately, when launching bash with --login, the --rcfile option is no longer active.

Has somebody an idea on the way to launch a login bash which reads a specified .rc file?

Best regards

Jean Johner
 
-----Message d'origine-----
De : JOHNER Jean 066030 
Envoyé : jeudi 29 juillet 2010 09:50
À : 'cygwin@cygwin.com'
Objet : Window shortcut to launch a Mintty login bash on a given directory

Hello,

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

C:\cygwin\bin\mintty.exe -e bash --login -c "cd foobar"

with the result that the Mintty window vanishes.

I also tried to add

C:\cygwin\home\User_name\foobar

in the "Start in" box of the windows shortcut. With no effect.

Thank you for your help.

Jean JOHNER

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Window shortcut to launch a Mintty login bash on a given directory
  2010-07-29  7:50 JOHNER Jean 066030
@ 2010-07-29  9:58 ` Gary
  2010-07-29 13:35 ` JOHNER Jean 066030
  2010-07-29 21:42 ` Andy Koppe
  2 siblings, 0 replies; 8+ messages in thread
From: Gary @ 2010-07-29  9:58 UTC (permalink / raw)
  To: cygwin

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.

Have you tried the chere package?


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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Window shortcut to launch a Mintty login bash on a given directory
@ 2010-07-29  7:50 JOHNER Jean 066030
  2010-07-29  9:58 ` Gary
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: JOHNER Jean 066030 @ 2010-07-29  7:50 UTC (permalink / raw)
  To: cygwin

Hello,

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

C:\cygwin\bin\mintty.exe -e bash --login -c "cd foobar"

with the result that the Mintty window vanishes.

I also tried to add

C:\cygwin\home\User_name\foobar

in the "Start in" box of the windows shortcut. With no effect.

Thank you for your help.

Jean JOHNER

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-08-02 11:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-31 15:00 Window shortcut to launch a Mintty login bash on a given directory JOHNER Jean 066030
2010-07-31 16:54 ` Andy Koppe
  -- strict thread matches above, loose matches on Subject: below --
2010-08-01 14:16 JOHNER Jean 066030
2010-08-02 11:48 ` Andy Koppe
2010-07-29  7:50 JOHNER Jean 066030
2010-07-29  9:58 ` Gary
2010-07-29 13:35 ` JOHNER Jean 066030
2010-07-29 21:42 ` Andy Koppe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).