It is currently Tue, 07 Dec 2021 02:49:28 GMT

Author Message
 tcsh xterm title bar quoting
I think I have a quoting problem.

I'm installing a new mail server, and want to have several windows
various log files.

So in one window I have tail -f /var/log/maillog
And in another window I have
tail -f /var/mail/mailstream | egrep "Subject:|X-Spam|To:"

I have precmd and postcmd aliased as follows:
        alias postcmd '/bin/echo -n "^[]2;\!#^G"'
        alias precmd '/bin/echo -n "^[]2;${H}:$cwd^G"'

So when I'm at the prompt, my title bar is hostname,current working
And when I'm running a command, the title bar is the command.

This is right out of the tcsh man page and it works generally, but for
the second tail command (with egrep) it fusses about the To:

postie# tail -f /var/mail/mailstream | egrep "X-Spam|Subject:|To:"
To: ^G: Command not found.

I've had some other odd results, and on one occasion it worked, but
it seems to have some dependency on what has happened before.


correspondence may be transmitted to user sbotsford domain sjsa ab ca

 Sun, 18 Mar 2007 23:57:39 GMT   
 tcsh xterm title bar quoting

I create a file that is unique per host, and store the proper characters inside.
This takes a few commands, but once I have it, I just need a "source" to re-set the variables.
Here is is:

# have I executed this script before on this system?
set _H_FILE = ~/.echo.${HOSTNAME}.csh
if ( $?_E ) then
#       echo "already set the echo variables">/dev/tty
else if ( -f ${_H_FILE} ) then
        source ${_H_FILE}
# Note - execute external processes are only done once per system
else if ( `echo -n |wc -l`  == 0 ) then
#       echo "built in echo is bsd" >/dev/tty
        # then berkeley style echo
        echo 'set ech = "echo -n"' >${_H_FILE}
        echo "set _E = `echo a | tr a '\033'`" >> ${_H_FILE}
        echo "set _B = `echo a | tr a '\007'`" >> ${_H_FILE}
        echo 'set _N = ""' >> ${_H_FILE}
        source ${_H_FILE}
#       echo "built in echo is sysV" >/dev/tty
        echo 'set ech = "echo"' >${_H_FILE}
        echo 'set _E = "\033"' >> ${_H_FILE}
        echo 'set _B = "\007"' >> ${_H_FILE}
        echo 'set _N = "\c"' >> ${_H_FILE}
        source ${_H_FILE}

Once I have done this, instead of

I use what would be
         alias postcmd '${ech} "${_E}]2;\!#${_B}${_N}"'
         alias precmd '${ech} "${_E}]2;${H}:$cwd${_B}${_N}"'

This always uses the built-in version of echo. and works no matter
what flavor the system is.

Sending unsolicited commercial e-mail to this account incurs a fee of
$500 per message, and acknowledges the legality of this contract.

 Mon, 19 Mar 2007 05:16:30 GMT   
   [ 2 post ] 

Similar Threads

1. display pwd in xterm title bar with tcsh

2. Dynamically changing xterm title bar in tcsh

3. window title bar and tcsh

4. How to change xterm title bar string?

5. Change xterm title bar?

6. Changing the title bar for Xterm Windows!!!!

7. quoting for prompt or xterm title in csh

8. display the current directory in xterm title bar

9. HOW to write to xterm title bar from ksh

10. current directory in xterm title-bar

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software