Naming Cygwin Shells

View: New views
9 Messages — Rating Filter:   Alert me  

Naming Cygwin Shells

by bluewolf :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Simple question here. I am trying to figure out a way to name a cygwin shell so that I can have multiple windows up doing tails and other such functions and easily see what system i am looking at.

I know that in CMD if i want to change the name of a CMD window to shellname the command the command is simply> title shellname

It was suggested that for cygwin i would use> cmd /c title=shellname

but that die not work. does any one know how I could accomplish this?

Re: Naming Cygwin Shells

by Andrew Schulman-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>
> Simple question here. I am trying to figure out a way to name a cygwin shell
> so that I can have multiple windows up doing tails and other such functions
> and easily see what system i am looking at.

See the section on PROMPTING (and also the PROMPT_COMMAND variable) in the
bash manual for general information about what you can put in your bash
prompt.  To make some of that information go up into the window title, precede
it by the magic incantation '\[\033]0;\]' and follow it by '\[\007\]'.  I
can't remember where I learned this information.  For example,

start_window_title='\[\033]0;\]'
end_window_title='\[\007\]'
PS1="${start_window_title}\w${end_window_title}\$"

would give you the current working directory (\w) in the title bar.

I'm not sure how you'd get the name of the command that's currently executing
into the title bar, but it probably could be done.

Good luck,
Andrew.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


RE: Naming Cygwin Shells

by Dave Korn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 09 October 2007 10:50, Andrew Schulman wrote:

>
> I'm not sure how you'd get the name of the command that's currently
> executing into the title bar, but it probably could be done.

http://cygwin.com/cygwin-ug-net/using-cygwinenv.html#title

CYGWIN=title

    cheers,
      DaveK
--
Can't think of a witty .sigline today....


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Re: Naming Cygwin Shells

by Brian Dessent :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

bluewolf wrote:

> Simple question here. I am trying to figure out a way to name a cygwin shell
> so that I can have multiple windows up doing tails and other such functions
> and easily see what system i am looking at.
>
> I know that in CMD if i want to change the name of a CMD window to shellname
> the command the command is simply> title shellname

The default prompt has escape sequences that change the window title, so
that it contains the current working directory.  So unless you change
PS1, no matter what you do to set the title it will be overwritten on
the next prompt.

You can do this with a simple shell function.  For example, with the
following in your ~/.bashrc:

settitle()
{
  local t=$1
  if [ "x$t" == "x" ]; then t='\w'; fi
  PS1=$(perl -e '$_ = $ENV{PS1}; s,(\\e]0;).*(\\a),$1$ARGV[0]$2,i;
                 print' "$t")
}

... then you can just

settitle foo

or if it contains spaces:

settitle "foo bar"

or even including prompt escape sequences like:

settitle "dir: \w tty: \l foo bar"

or just "settitle" to get the default of \w.

Brian


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


one othe robservation about my install update

by Mike Marchywka-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I had moved /usr to a different disk from my other stuff for a variety of
reasons.
This had been working quite well with a link.
I noticed that during the update, someone created a new /usr directory:

$ ls -al  | grep usr
drwxrwxrwx+  16 Administrator  Users       0 Oct  8 18:26 usr
drwxrwxrwx+  16 Administrator  Users       0 Oct  8 18:26 usr

I'm still sorting this out but thought I would pass it along as it seems a
bit
surprising. Windoze explorer shows the two, one as a link folder and the
other
as a real directory. I'm going to try to copy the new dir into the old
linked dir
after backing up the old. Hopefully, everything will just merge...

_________________________________________________________________
Make every IM count. Download Messenger and join the i’m Initiative now.
It’s free. http://im.live.com/messenger/im/home/?source=TAGHM


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


RE: one othe robservation about my install update

by Dave Korn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 09 October 2007 12:04, Mike Marchywka wrote:

> I had moved /usr to a different disk from my other stuff for a variety of
> reasons.
> This had been working quite well with a link.
> I noticed that during the update, someone created a new /usr directory:
>
> $ ls -al  | grep usr
> drwxrwxrwx+  16 Administrator  Users       0 Oct  8 18:26 usr
> drwxrwxrwx+  16 Administrator  Users       0 Oct  8 18:26 usr
>
> I'm still sorting this out but thought I would pass it along as it seems a
> bit
> surprising. Windoze explorer shows the two, one as a link folder and the
> other
> as a real directory. I'm going to try to copy the new dir into the old
> linked dir
> after backing up the old. Hopefully, everything will just merge...

  Beware mountpoints!  I think that is why this has happened, but it does look
like an oversight in setup.exe that it goes and creates a directory in the
wrong place.


    cheers,
      DaveK
--
Can't think of a witty .sigline today....


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Parent Message unknown Re: Naming Cygwin Shells

by Paul McFerrin-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In some initial cygwin window, execute the following command line:

setpgrp rxvt --backspacekey ^H -sbt 15 -fg white -bg black -geometry
+75+80 -sr -title "SYSTEMxx" -tn ansi -sl 1500 -fn 'Lucida Console-12'
-e ksh &

and replace "SYSTEMxx" with what ever label you like.  This will create
another window with a shell and place the label at the top of the new
window.  You can then type in that window.  If you don't have a copy of
"setprgp.exe", you can remove it.  However, an interrupt in ANY window
will them them all off.  Or you can get a copy at:
http://pmcferrin.homedns.org/setpgrp.exe  It is a simple program that
executees the setpgrp(2) system call before executing the arguments.

With the above, there is no need to worry about the fuss of using escape
sequences to set your window's title.  Each window will have it's own
complete and independant environment to do anything.  The source to
setpgrp.c is at: http://pmcferrin.homedns.org/setpgrp.c

- paul

Also available from:  http://pmcferrin.homedns.org/
are:
   cygwin.bat
   .bash_login
which is what I use to start up cygwin, desktop icon: C:\cygwin\cygwin.bat

bluewolf wrote:

> Simple question here. I am trying to figure out a way to name a cygwin
> shell
> so that I can have multiple windows up doing tails and other such
> functions
> and easily see what system i am looking at.
> I know that in CMD if i want to change the name of a CMD window to
> shellname
> the command the command is simply> title shellname
>
> It was suggested that for cygwin i would use> cmd /c title=shellname
>
> but that die not work. does any one know how I could accomplish this?
>  

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Re: Naming Cygwin Shells

by Christopher Faylor-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Oct 09, 2007 at 02:47:01PM -0400, Paul McFerrin wrote:

> In some initial cygwin window, execute the following command line:
>
> setpgrp rxvt --backspacekey ^H -sbt 15 -fg white -bg black -geometry +75+80
> -sr -title "SYSTEMxx" -tn ansi -sl 1500 -fn 'Lucida Console-12' -e ksh &
>
> and replace "SYSTEMxx" with what ever label you like.  This will create
> another window with a shell and place the label at the top of the new
> window.  You can then type in that window.  If you don't have a copy of
> "setprgp.exe", you can remove it.  However, an interrupt in ANY window will
> them them all off.  Or you can get a copy at:
> http://pmcferrin.homedns.org/setpgrp.exe  It is a simple program that
> executees the setpgrp(2) system call before executing the arguments.

Isn't that what the "setsid.exe" program does?

cgf

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Re: Naming Cygwin Shells

by Paul McFerrin-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Christopher Faylor wrote:

> On Tue, Oct 09, 2007 at 02:47:01PM -0400, Paul McFerrin wrote:
>  
>> In some initial cygwin window, execute the following command line:
>>
>> setpgrp rxvt --backspacekey ^H -sbt 15 -fg white -bg black -geometry +75+80
>> -sr -title "SYSTEMxx" -tn ansi -sl 1500 -fn 'Lucida Console-12' -e ksh &
>>
>> and replace "SYSTEMxx" with what ever label you like.  This will create
>> another window with a shell and place the label at the top of the new
>> window.  You can then type in that window.  If you don't have a copy of
>> "setprgp.exe", you can remove it.  However, an interrupt in ANY window will
>> them them all off.  Or you can get a copy at:
>> http://pmcferrin.homedns.org/setpgrp.exe  It is a simple program that
>> executees the setpgrp(2) system call before executing the arguments.
>>    
>
> Isn't that what the "setsid.exe" program does?
>  
I came from 25+ years SVR3/SVR4 Bell Labs Unix background.  There was no
such "setsid" so I wrote (quite trivial) setpgrp(1) to match the Syscall
setpgrp(2).  I'm sure that GNU/Cygwin has much more to offer and as time
go by, I'll become aware of them.  I thank you for bringing that to my
attention.

-paul
> cgf
>
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Problem reports:       http://cygwin.com/problems.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
>
>  

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/