harp@Pkg.Mcc.COM (Christopher North-Keys) (10/03/90)
In article <1990Oct3.011511.2263@mlb.semi.harris.com>, geg@beep.mlb.semi.harris.com (Greg Garland) writes: | In article <28434@pasteur.Berkeley.EDU>, stolcke@ICSI.Berkeley.EDU (Andreas Stolcke) writes: | |> In article <6459@vanuata.cs.glasgow.ac.uk>, sinclair@cs.glasgow.ac.uk (Duncan Sinclair) writes: | |> |> Using tcsh, I set re-set the title of xterm before each shell prompt, | |> May I suggest a different approach to the same end. Instead of | |> having the tcsh prompt string set the title bar on every command, | |> alias the `cd ' command so as to set it only when actually changing the | |> current directory. (This should work for any shell with something equivalent | |> to an aliasing mechanism). | |> | | Better call it something besides 'cd', though, like 'xcd'. I called it 'cd' | originally, but I noticed that when I ran sunview (to use some non-X stuff) | the escape sequences seem to cause the SunView 'shelltool's to hang. | | Greg G. DISCLAIMER: If there's an obviously better way in the Csh, just *tell* me, eh? Try making the alias "c", and then, in your .cshrc startup scripts, set the directory-echo alias (here, ".") appropriately for the window system. Possible approaches: X windows: DISPLAY should exist, and TERM will be "xterm" Sunview: WINDOW_PARENT should exist, and TERM will be "sun" or "sun-cmd" An example (condensed from the elfshell, version 29) using $term: --------- setenv esc '^[' # an escape char setenv bel '^G' # a bell char setenv HOSTNAME `hostname` setenv HOSTNICK `expr $HOSTNAME : '\([A-Za-z0-9-]*\)\..*' \| $HOSTNAME` if ($?tcsh) then alias c 'cd \!*' # Don't alias this to "cd"---bad. alias cwdcmd . # This arranges for "cd" to update the title as well. else alias c 'cd \!* ; .' # Don't alias this to "cd"---bad. endif if (! $?term) set term = '' # fall through to default. switch ("$term") case "sun*": alias . 'header [-${HOSTNICK}- `dirs` ]' alias header 'echo -n "$esc]l\!*$esc\"' alias iheader 'echo -n "$esc]L\!*$esc\"' alias icon 'echo -n "$esc]I\!*$esc\"' breaksw case "xterm": alias . 'header [-${HOSTNICK}- `dirs` ];iheader ${HOSTNICK}: $cwd:t' alias header 'echo -n "$esc]2;\!*$bel"' alias iheader 'echo -n "$esc]1;\!*$bel"' alias icon 'echo -n "$esc]I;\!*$bel"' breaksw default: alias . 'dirs' set term = `tset - -I -Q -r -m :\?vt100` breaksw endsw --------- Other aliases, some using environment variables. Note that EDITOR gets reset by sunview and X startup scripts to be emacsclient instead of vi. alias .. 'cd ..; .' alias ... 'cd $cwd:h ; .' # A neat trick to move to the *logical* parent. alias / 'clear ; .' # Root of screen (?) alias ~ 'cd ~\!* ; .' alias j 'jobs -l' alias p '$PAGER' alias h 'history -r | p' alias f 'fg %\!:1' alias y '$EDITOR' # "yank" (was "warp") for emacsclient program alias ]d 'pushd \!* ; .' alias [d 'popd ; .' # Be verra careful not t'hide the system rm --- should NOT be a script. alias rm 'ls -Fsd \!*; echo -n "remove? "; if ("$<" == "y") /bin/rm \!*' -- ________________________________________________________________________ _______ Christopher Alex.North-Keys Associate Systems Analyst Group Talisman Harp[@Mcc.Com] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~
brister@decwrl.dec.com (James Brister) (10/03/90)
On 3 Oct 90 04:27:40 GMT, harp@Pkg.Mcc.COM (Christopher North-Keys) said: > In article <1990Oct3.011511.2263@mlb.semi.harris.com>, > geg@beep.mlb.semi.harris.com (Greg Garland) writes: > | In article <28434@pasteur.Berkeley.EDU>, stolcke@ICSI.Berkeley.EDU > (Andreas Stolcke) writes: > | |> In article <6459@vanuata.cs.glasgow.ac.uk>, > sinclair@cs.glasgow.ac.uk (Duncan Sinclair) writes: > | |> |> Using tcsh, I set re-set the title of xterm before each shell > prompt, > | |> May I suggest a different approach to the same end. Instead of > | |> having the tcsh prompt string set the title bar on every command, > | |> alias the `cd ' command so as to set it only when actually changing > | |> the tcsh version 5.18 has a special alias called cwdcmd that is run automatically any time the $cwd variable is set. It is trivial to get the title to change using this facility and no messing around with the prompt string. James -- James Brister brister@decwrl.dec.com DEC Western Software Lab., Palo Alto, CA {uunet,sun,pyramid}!decwrl!brister
rhoward@msd.gatech.edu (Robert L. Howard) (10/04/90)
In <BRISTER.90Oct3111036@westworld.decwrl.dec.com> brister@decwrl.dec.com (James Brister) writes: : {a lot of people write...} : >> | |> |> Using tcsh, I set re-set the title of xterm before each shell >> prompt, >> | |> May I suggest a different approach to the same end. Instead of >> | |> having the tcsh prompt string set the title bar on every command, >> | |> alias the `cd ' command so as to set it only when actually changing >> | |> the >tcsh version 5.18 has a special alias called cwdcmd that is run >automatically any time the $cwd variable is set. It is trivial to get the >title to change using this facility and no messing around with the prompt >string. A related question.... However the tcsh feature, $sl and $el (for status lines), is not set by tcsh on my system. Sun Sparc SunOS 4.1 tcsh version tcsh 5.19 (Cornell) 9/26/90 Patch level 1 Running xterm under X11r4 (PL 18). When tcsh starts it sets term, TERM, TERMCAP and a lot of others but sl and el are left blank. Am I doing something wrong? (The value of TERMCAP shows that the xterm definition contains strings for ts and fs.) Has anyone had success using this under tcsh? Thanks, Robert BTW, Where in the xterm docs can I found out what the string to set the title should be? -- | Robert L. Howard | Georgia Tech Research Institute | | rhoward@msd.gatech.edu | MATD Laboratory | | (404) 528-7165 | Atlanta, Georgia 30332 | | UUCP: ...!{allegra,amd,hplabs,ut-ngp}!gatech!msd!rhoward |