Welcome to the Linux Gazette Mail Bag!

Copyright (c) 1996, John M. Fisk <fiskjm@ctrvax.vanderbilt.edu>
Published in Issue #7 of the Linux Gazette

As always, I really appreciate all of the letters that folks have taken the time to pen. With added work at school I've been a bit pressed for time and so haven't had the time to comment here on each letter. I apologize for this, but am happy just to have the time to get this issue out! :-)

Please don't hesitate to drop the author of a letter a note yourself if there's something you'd like to follow up on. Also, there is a letter by Jeff Richards with a question regarding VI, ftp, and the corruption of the correct backspace definition after these programs have finished executing. I've experienced this problem myself and honestly haven't an answer for him. Any takers...? :-)


-- John

Date: Wed, 20 Dec 1995 12:36:42 CST
From: Its Lonely Here <root@mail.bricbrac.de>
To: <fiskjm@ctrvax.Vanderbilt.Edu>
Subject: Stuff you got to try :)


Good Nov. issue. Thanx for your continued & funny contributions.

Stuff you may want to tangle with and write about:

Iain Lea

Date: Mon, 12 Feb 1996 17:00:04 CST
Sender: <tyger@ctrvax.Vanderbilt.Edu>
From: Tyger <tyger@eden.com>
To: <fiskjm@ctrvax.Vanderbilt.Edu>
Subject: PGP compile for linux/ELF


I just came across something that I thought would be nice to submit to the mailbag. I came looking for hints in the LG when I was having trouble and it wasn't there. :) So I thought I'd drop a line.

I discovered, much to my sorrow, that pgp refuses to compile on ELF systems. Happily, I found a little fix for it on the net. I can't take credit.

To make it behave and compile as an ELF binary two changes need to be made. One to 80386.S and one to zmatch.S - these files are found in the /src directory of the untarred pgp distribution.

Near the top of each file, there is an #if directive. They need to be altered thusly - (I forget which one is in which file but it's obvious when you look at them):

#ifndef SYSV     gets changed to
#if !defined(SYSV) && !defined(__ELF__)
#ifdef SYSV      gets changed to
#if defined(SYSV) || defined (__ELF__)

Note the double underscores on either side of "ELF". This is crucial.

Change those directives and it'll do a nice clean compile. Crypto away.


------------------------  http://www.eden.com/~tyger  -------------------------

Date: Thu, 07 Mar 1996 19:33:18 CST
From: Tim Newsome <drz@cybercomm.net>
To: <fiskjm@ctrvax.Vanderbilt.Edu>
Subject: 2-ct. tip


Here's a nifty little shell script I wrote a while ago (I call it scribble): #!/bin/sh


[ -z $1 ] && (cat >> $NOTESFILE;exit)
echo $* >> $NOTESFILE;

All it does is append either it's arguments, or the data on stdin to the NOTESFILE. I use it for cases like:
scribble 123-4567 jane
made a link from a to b
changed the global PATH

I find it rather useful, hope you do too. BTW, when is the next Linux Gazette coming out?


Tim Newsome. drz@cybercomm.net. http://www.cybercomm.net/~drz/.
Java rules. Linux > Windows. question=(be||!be); answer=42; hack!=crack;
politics=crime; Quidquid latine dictum sit, altum viditur. Egotist, n:
A person of low taste, more interested in himself than me. 

Date: Mon, 08 Jan 1996 22:07:48 CST
From: <=?iso-8859-1?Q?Anders_=D6stling_=3Canos=40mailer.neurope.ikea.se=3E?=@mailer.neurope.ikea.se>
To: <fiskjm@ctrvax.Vanderbilt.Edu>
Subject: The Gazette !

Hi John

First of all, thanks for a very nice publication. I have downloaded all your "editions" of The Linux Gazette, and found many valueable hints and advise.

Here is one of my own;

If you want to make sure that you don't "rm *" in the wrong directory, create a file called "-i"=20 in each directory that you want to protect. When the shell expands the "rm *", it will expand to "rm -i file1 file2" etc, and automatically ask for permission to delete. This will increase the chance that you detect your error by a magnitude !

Keep up the good work !

Anders =D6stling
IKEA Europe Information System, Sweden

- Anders =D6stling, Helsingborg SE -------
- E-mail anders.ostling@helsingborg.se --
- Voice/Fax +46-42-833 47 --------------

Date: Wed, 20 Dec 1995 11:47:15 CST
From: <aqui@VNET.IBM.COM>
To: <FISKJM@ctrvax.Vanderbilt.Edu>
Subject: Linux Gazette linked to aqui!

Congrats! Your web page http://www.tenn.com/fiskhtml/gazette_toc.html has been linked into aqui!

Thanks from the folks at http://www.aqui.ibm.com

ps: to see the links, enter your URL in the 'Here's a web page' field and press Show!

Date: Fri, 09 Feb 1996 15:10:26 CST
From: Jeff Richards <jeff@aesyvr2.pwc.bc.doe.ca>
To: <fiskjm@ctrvax.Vanderbilt.Edu>
Subject: Re: Linux Gazette

Just wanted to send a quick note to say that I like your electronic magazine, and to also suggest an idea for a future issue. It concerns a problem that I can't seem to solve(possibly because I just don't know what I'm doing - at least as far as Linux is concerned - I have used other Unix variants for 10-15 years).

While I have the backspace set correctly using stty erase and it functions fine when I'm typing commands at the console, when I enter vi, it no longer works. The same is true within ftp. However, I have found that the control-H key combination does work - just not the backspace key.

And even stranger, if I telnet in from another machine the backspace key works in both vi and ftp - it only fails if I physically sit at the console.

Any ideas why this phenomenon is happening? Perhaps others have come across this. I know I'd love the solution to the mystery and perhaps others might as well.

Thanks in advance for any info.

PS: I'm using Slackware 1.2.3 at present, and haven't diddled with the kernel or done any other fiddling about. I've just been evaluating Linux as compared to the Unix available on our workstations(HP & Sun).

|Jeff Richards                     | Voice: +1 (604) 664-9140           |
|Atmospheric Environment Service   | Fax:   +1 (604) 664-9195           |
|Pacific Weather Centre            +------------------------------------+
|700 - 1200 West 73rd Avenue       | Email: jeff@aesyvr2.pwc.bc.doe.ca  |
|Vancouver, BC  CANADA  V6P 6H9    | IRC:   Horus                       |

Date: Sat, 10 Feb 1996 11:23:28 CST
From: Jesper <blackie@imada.ou.dk>
To: John M. Fisk <fiskjm@ctrvax.Vanderbilt.Edu>
Subject: Dangerous Commands

Hi John. How about a thread in The Linux Gazette aboyt dangerous commands (ie. command which realy can mess up your system.)

I can think of three, right now, but I'm very sure there are many mores.

rm - well you know about that one

tar - yes realy, try 'tar cvf * | (cd /backup; tar xf -)'. I did that the other day. What I relay wanted was to move a hiracy of files, to /backup, but I forgot a '-' before the start, so what tar realy did was to create a tar achive in the first file, which the star expanded to. Another on cavet is when you type 'tar cf ..' instead of 'tar xf ..', tar overwrite without saying a word....

chmod,chown,chgrp - thing of all the files located around the system. Some of the have to be readable for every one, some of the have to belong to the group bin, others must be owned by root or deamon etc. etc. A chown/chmod/chgrp recursive will surely mess up your system that much that you have to reinstall your whole system.

Kind Regards Jesper

Date: Tue, 23 Jan 1996 23:51:57 CST
From: H.E. Butterworth <heb1001@hermes.cam.ac.uk>
To: <fiskjm@ctrvax.Vanderbilt.Edu>
Subject: Homemade icons


Here is a quickie suggestion for your linux gazette.

Effortless fvwm icons - no artistic skill required (for 16bpp or 32bpp displays - not recommended for 8bpp (you'll run out of colours)):

  1. Take your application window and make it smaller so that the size of the significant features in the window is relatively large compared with the size of the window itself.
  2. Use XV to grab a shot of the window.
  3. Use XV to resize the window to 8x or 16x the desired size of your icon.
  4. Save the image and reload using XV (this step seems to be necessary to make XV change its representation from one of a small image that has been enlarged to a large image at its natural resolution - You may know how to do this without a save and reload - I don't).
  5. Use XV to pixellize the image by a factor of 8 or 16 as above.
  6. Use XV to resize the image to the desired size of your icon.
  7. You now have an antialiased miniature image of the full size window - save it as an XPM file somewhere where it will be safe for all time.
  8. Repeat the above as desired for other applications.
  9. Set the pixmap path in your .fvwmrc to the directory containing your icon image(s).
  10. Associate the icon image with an application in your .fvwmrc file.
  11. Sit back and admire your new-look desktop.


Date: Tue, 16 Jan 1996 21:51:17 CST
From: Dean Carpenter <deano@areyes.com>
To: <fiskjm@ctrvax.Vanderbilt.Edu>
Subject: Re: Yet another HACK script

Just a point to note with hack. Once you start using it to maintain a config file, you really should keep using it. You can make any changes you want to a file under hack's control as root and force the save (they're changed to be readonly), but the next time you hack that file, RCS will replace it with its stored version.


Hack a file so it has lines one, two and three.
Save it.
Now edit that file as root and add lines four five and six.
Save it with :w! to force the save.
Hack the file again, and note that lines four five and six are gone.
RCS has replaced the files with the "correct" version as far as it's concerned from the /configs/RCS/file,v file.

Just the way RCS works.

Dean Carpenter		deano@areyes.com
Areyes, Inc.		dcarpenter@kraft.com

"No matter where you go, there you are"  sayeth Buckaroo 								 across the Eighth Dimension

Date: Tue, 23 Jan 1996 17:16:26 CST
From: Sys admin hetz <supernet@netvision.net.il>
To: <fiskjm@ctrvax.Vanderbilt.Edu>
Subject: Linux 3D logo

Hi there,

Well, it's my 1st time on your pages, and they look REALLY good, so I just printed them so I can read them while i'll be on my way from work to my home.

Anyway, I include a JPG file with some sort of LINUX logo, so people can put it in the background. It was done using 3D Studio version 4.

I hope you can put it on your next Linux Gazzette so people can download it from you.

Keep up the good work, my Friend :)

Hetz Ben Hamo
Sys. Admin.
Supernet Ltd.

Date: Thu, 14 Mar 1996 08:14:23 CST
From: James Garriss <jpg@langley.mitre.org>
To: <fiskjm@ctrvax.Vanderbilt.Edu>
Subject: RE: Linux on PowerMac

>On Mon Mar 04 14:33:15 1996 James Garriss wrote:
>>Thanks for your help. I spend one night last week intensively surfing for
>>info. I found the new site for the mailing lists as well as two homepages
>>on Linux for PowerMac. From what I gathered, it will be available 2Q96 or
>>Summer 96. I'd give you the homepages, but they're on my Mac at home. Let
>>me know if you're interested.
>Yes, I'd be very interested. If you'd just drop a note with the URL's then I'd
>be glad to include them for those who are running Mac's as I'm sure that there
>are those that would be interested in this as well.
http://www.gr.osf.org/mklinux/ http://www.linuxppc.org/

James Garriss                        |  I know you believe you understood
-> jpg@langley.mitre.org             |  what you think I said,
--> garriss@cs.odu.edu               |  but I'm not sure you realize that
---> http://www.cs.odu.edu/~garriss  |  what you heard is not what I meant.

Date: Tue, 16 Jan 1996 10:26:06 CST
From: Larry Doolittle <doolitt@recycle.cebaf.gov>
To: <fisk@tenn.com>
Subject: Linux HomeBoy WebPage

John -

I like your page, but I don't like the implication that Netscape is the best or only HTML+ capable browser. I suggest you include parallel references to Arena which also does justice to your page.

While you're at it, most browsers (Netscape, Mosaic, Arena, Chimera) are good at putting the width and height specifiers in img tags to good use. e.g., <img src="http://recycle.cebaf.gov/~doolitt/Doolittle.jpg" width=143 height=170> Your page would come up cleaner (especally with your slow link) if you put these in.

- Larry Doolittle ldoolitt@cebaf.gov

Date: Fri, 16 Feb 1996 12:10:12 CST
From: Barry Sanderson <barrydon@surf-ici.com>
To: <fiskjm@ctrvax.Vanderbilt.Edu>
Subject: Helpful PPP scripts

16 Feb 1996


I found your "Helpful PPP scripts", from the August 1995 issue of the Linux Gazette, VERY helpful. Thanks for sharing them.

Near the bottom of the man page for pppd, it is revealed that the file /etc/ppp/ip-up is automatically run just after the ppp link is established. By putting your "pppon" script commands in this file, you can avoid having to manually run pppon.

Initially, the last portion of my local IP address (as extracted by your pppon script) was missing. Apparently, my numerical IP address is longer than yours. Changing the

cut -b 21-32

from your script to

cut -b 21-36

will properly extract the longest legal numerical IP address. Note that positional parameter $4 passed to /etc/ppp/ip-up is the numerical local IP address. Thus, if you want, you can get the local IP address value to write to /etc/hosts from $4, rather than from /sbin/ifconfig ...

Although I too am the only person who uses my system, I don't do everything as root. In order to alow non-root users to write to the /etc/hosts file, I changed the

echo " ... " > /etc/hosts

command in your pppon script to

su root -c "echo \" ... \" > /etc/hosts"

Note that the double quote characters (") enclosing the text to be sent in your pppon script are escaped (\") in my modified version. Also, note that double quote characters are used to enclose everything after su root -c in my modified version.

Thanks again.

Barry Sanderson barrydon@surf-ici.com

Date: Sun, 28 Jan 1996 12:19:42 CST
From: Alan Bailward <Alan_Bailward@mindlink.bc.ca>
To: <fiskjm@ctrvax.Vanderbilt.Edu>
Subject: error in LG!

Hi John. I was just going through the LG and trying out all the cool new stuff and I found that in the first or second letter (the one about changing the prompt colors - the line that is put into the .profile has all " ' "'s, they should be " ` "'s. ie:

export PS1="\['setterm -foreground green'\] etc
*should be*
export PS1="\[`setterm -foreground green`\] etc

All the ' should be ` (backquotes, not appostraphies (sp?)). This makes the shell use the *result* of the commands, not the literal command.

(keep up the good work)

 Alan Bailward                       | There are two kinds of programmers,
 alan_bailward@mindlink.bc.ca        | those with humour, and those without
 http://mindlink.bc.ca/alan_bailward | sanity.          -someone else

Date: Wed, 24 Jan 1996 00:51:18 CST
From: Andy Parkerson <andyp@tamu.edu>
To: <fiskjm@ctrvax.Vanderbilt.Edu>
Subject: Setterm and the Linux Gazette


Kudos on your great resource for Linux Users!

In the November issue, you mention setterm. I have found that the best use for this (IMHO) is to determine which user is currently logged in. I rarely log in as root, and have found that I often forget that I am root. What I have done is changed the screen color for root to a nice bright red screen with red letters whenever I am root. This way I know who I am (I also know whenever someone else that I let use my computer hacks in to my superuser :-) ). I have edited the following files:


-->   add the following lines:
	setterm -background red -foreground yellow- bold -store
	alias logout='setterm -background blue -foreground white -bold -store ; clear'


-->   add the following lines:
	setterm -background red -foreground yellow -bold -store
	alias exit='setterm -background blue -foreground white -bold -store ; clear'

This way, whether I login as root, or if I "su" to root, I change the color. I also recommend changing the prompt to something obnoxious like "*****ROOT*****:/>" just to make the point.

I guess that you could do this for every different user that you used, such as webmaster, or KoolMoDee... Whatever.

Now, do you have any way to interactively change the background colors in an xterm? I use X a lot, and this would be nice.

Thanks for the help, and once again, good job!


Andy Parkerson			mailto:andyp@tamu.edu
Texas A&M University		http://utnapishtim.dorms.tamu.edu/~andyp/

Date: Sat, 06 Jan 1996 21:31:34 CST
From: Sam Lantinga <slouken@cs.ucdavis.edu>
To: <fiskjm@ctrvax.Vanderbilt.Edu>
Subject: splitvt in Linux Gazette

Thanks for the blurb of the September issue of the Linux Gazette. I appreciate it. :)

Do you mind if I put it in the next splitvt distribution?

I'd also be interested in any interesting ways you or anyone else has found to use splitvt, and also what you think would make it better. :)

Thanks alot! :)

-Sam Lantinga (slouken@cs.ucdavis.edu)

Author of splitvt -- get the new version with security fixes from

Date: Sun, 21 Jan 1996 17:15:22 CST
From: Joey Hess <joey@kite.ithaca.ny.us>
To: <fiskjm@ctrvax.Vanderbilt.Edu>
Subject: supermount

I applied your article on supermount to my RedHat system, and discovered a problem. I thought I'd warn you about this.

it seems that RedHat's 'mount' command is different than the stock linux mount. At least, it didn't like the /etc/fstab line for supermount. When I put in the line you recoomended, I'd get something like this:

[Root] />mount
/ on /a type supermount (rw,fs=msdos,dev=/dev/fd0)
/dev/hda1 on /dos type msdos (rw,noexec,nosuid,nodev,umask=0)
/dev/hdb2 on /home type ext2 (rw)
/dev/hdb4 on /usr type ext2 (rw)
/proc on /proc type proc (rw)

The supermount on /a somehow superceded the "/dev/hdb1 on / type ext2 (rw)" line that's normally at the top of the output of mount on my system. I was unable to unmount / or /a.

What's really bad about this is, if you reboot, it is unable to unmount your actual root partition, and then when it boots up, it mounts it read-only, and things are very bad..

My fix was to use this line in /etc/fstab:

/a    /a     supermount   rw,fs=msdos,dev=/dev/fd0   0 0

|--notice that /a. I think that for supermount, this field is just a 
placeholder, you can fill it with anything. So I picked something 
innocuous. Now it works, and mount reports:

/dev/hdb1 on / type ext2 (rw)
/dev/hda1 on /dos type msdos (rw,noexec,nosuid,nodev,umask=0)
/dev/hdb2 on /home type ext2 (rw)
/dev/hdb4 on /usr type ext2 (rw)
/proc on /proc type proc (rw)
/a on /a type supermount (rw,fs=msdos,dev=/dev/fd0)

Thanks for the great articles in the Gazzette..


         "How appropriate, you fight like a cow." -- Monkey Island

Date: Wed, 14 Feb 1996 09:26:32 CST
From: Rod Troch <troch@texas.com>
To: <fiskjm@ctrvax.Vanderbilt.Edu>
Subject: TIP LG: Copying files > 1.4 Mb to floppy


I originally posted this tip to the c.o.l.m newsgroup back in August of 1995. I think it is a valuable tip and am forwarding it to you for possible inclusion in the next LG.

How many times have you needed to transport a file larger then 1.44Mb via floppies and did not know how? I have on many occasions. It finally became a desperate situation and I was forced to read the man page for Gnu Tar. I am glad I did!

The following command will let you tar either a single file or multiple files and span them across multiple floppy disks. This is the command that seems to work best for me:

'tar -cvMf /dev/fd0H1440/ files-to-betarred.gz'

I hope this helps some folks who may have been scratching their heads over just this issue.


Rod Troch  N2ZVV                             | Don't mess with TEXAS.
troch@texas.com                              | Lonestar - A Linux box
http://www.texas.com/                        | FTP for Pgp key
"Don't ever ask anybody if they are from Texas; if they are, you'll 
know it.  If they aren't, you'll just make 'em feel bad."  -Anonymous

Date: Wed, 31 Jan 1996 23:16:02 CST
From: Michael Shelton <mshelton@onyx.idbsu.edu>
To: <fiskjm@ctrvax.Vanderbilt.Edu>
Subject: VI

Is fmt usable in vi as well as vim?

Also, is fmt available in UNIX, not just Linux?

One more thing, in your Nov. issue, you talk about using '/' and '?' to search out strings. Not only can you use 'n' to move forward in a '/' search, or backwards in a '?' search, but if you use 'shift+n' it will reverse whatever mode you are in. (i.e. If you start in '/' mode, typing 'shift+n' will go to '?' mode and reverse the search one step. Watch the status on the bottom of the screen, it indicates which is which).

Mike Shelton

Date: Thu, 07 Mar 1996 09:49:42 CST
From: Les Schaffer <godzilla@futuris.net>
To: <fiskjm@ctrvax.Vanderbilt.Edu>
Subject: XF-Mail


I liked your article a lot, even though i have been compiling Linux codes on my own for over a year.

But just in case you get other queries from desperate people:

As you may be aware, the 0.3 XF-Mail release doesnt work right with the newer (> 3.4f) Xpm libs. Specifically, a call to the xform function fl_set_pixmapbutton_data fails with a segmentation fault.

I also noticed a problem with dirent.h ... xfmail calls dirent->d_namlen but it should be dirent->d_reclen . there is a define fix in the dirent.h, but it didnt work for me and i had to put it in by hand to get a compile...

I then upgraded to the alpha release of the newest xforms library, but some of the calls have changed their arguments. I fixed them up, and the xfmail program then ran, but things weren't quite right (menu bar was at bottom, message bar at top!)

Then i noticed that there was an alpha release of the newest version of xfmail, and that compiles with my eyes closed and the latest Xpm and xform libraries...


Les Schaffer

Date: Thu, 01 Feb 1996 12:58:59 CST
From: Jim Nicholson <libadm8@bns02.bns.att.com>
To: <fiskjm@ctrvax.Vanderbilt.Edu>
Subject: xterm escapes - one more time

I saw a few examples of getting bash to put the current directory into the titlebar, but they all either replace "cd" or change the prompt. Here's a method that takes advantage of PROMPT_COMMAND:

use Escape for ^[ and Ctrl-G for ^G when adding this to your .bash_profile.

if [ "$?PROMPT" ]; then
    if [ "$TERM" = "xterm" ]; then
       echo -n "^[]2;xterm: `pwd`^G"
       export PROMPT_COMMAND='echo -n "^[]2;xterm: `pwd`^G"'

It works because PROMPT_COMMAND gets executed each time the current directory is changed. The only downside is having to do the "echo" up front; this is required because PROMPT_COMMAND doesn't get executed when the shell first fires up.

- Jim

Jim Nicholson          | libadm8@bns02.att.com
BCS SMTS IOL Project   | http://iol.bns.att.com/
908-457-1835           | http://cnj.digex.net/~pcks/jim/home.html
From: Jim Nicholson <jnich@nj40e4fw.bns.att.com>
To: "John M. Fisk" <fiskjm@ctrvax.Vanderbilt.Edu>
Subject: RE: xterm escapes - one more time

One correction: In my email, I stated that PROMPT_COMMAND gets called by bash whenever the current directory is changed. There *IS* a facility like that in tcsh (I forget the name of the environment variable), but PROMPT_COMMAND is slightly different: it gets run each time bash is about to issue a prompt. Thus, you can do things like:

export PROMPT_COMMAND="touch $HOME/.last.prompt"

and ~/.last.prompt will be time-stamped with the approximate time that the last command finished...

I really enjoy LG, by the way. Would you be interested in an in-depth discussion of how to set up xdm? I can't promise it for your next issue, but I really should write something about the setup that I use; it's become quite popular with the programmers in my project team.

- Jim

Jim Nicholson          | libadm8@bns02.att.com
BCS SMTS IOL Project   | http://iol.bns.att.com/
908-457-1835           | http://cnj.digex.net/~pcks/jim/home.html 

Date: Tue, 05 Mar 1996 13:30:30 CST
From: Raul Benito Garcia <raul@panoramix.fi.upm.es>
To: <fiskjm@ctrvax.Vanderbilt.Edu>
Subject: XTERM folluw-up

Hi John,

Thanks for your time and your wonderful gazette, here it is my contribution to the million tons of mails that you may have about this subject.

Changing the xterm titlebar using aliases can led you to a wrong one If you do a lot of telnet or rlogin to anothe system that changes your titlebar too.

But you can solve it in BASH with the


variable that runs the command in it every time it has to write a new prompt(I have also try to use a prompt that changes my titlebar but I find it terrible slowing editing long lines.)

I put this in my bashrc.

 PROMPT_COMMAND='echo -ne "\033]2;bhole:$PWD$\007"'

Hope that you find it useful and understable(english isn't my first language).

Have you see the wonderful tkman (a X manual pager really cute, written it Tcl/Tk). I also invite to see the Bowman Window Manger (it trys to convert your linux box in a NeXt one)

Thanks again for your magazine,

Raul Benito Garcia
Ars Longa, vita brevis

From: R.S. MALLOZZI, ES-84, 205-544-0887 <MALLOZZI@bowie.msfc.nasa.gov>
To: <fiskjm@ctrvax.Vanderbilt.Edu>
Subject: Xterm title

Hi John,

First of all, I'd like to tell ya how much I enjoy the LG. The tips are cool, and don't change your style of writing! Anyway, I was digging through some papers today and found the November issue of the LG, and started glancing through it again. I noticed in the section about the xterm title bar where you talked about setting the current working directory as the title that you could not get it to work with BASH. Here is a section of my ~/.profile that does it:

- - - - - - - - - - - - - - - - Start ~/.profile - - - - - - - - - - - - - - - - 

# This function sets the xterm title to be the argument of xtitle
#  It is used below so that 'cd' will write the current directory
#  to the xterm title (see November Linux Gazette for explanation of
#  the escape sequences, and how to insert them)
    if [ "$*" != "" ]; then
       echo -n "]0;$* "
       echo -n "]0;xterminal:`/usr/bin/tty`"

# Only write to xterm if X is running
if [ "$DISPLAY" ]; then

   # Assign the titles of any xterms started in ~/.xinitrc
   xtitle $PWD
       cd $1
       # Set the xterm title
       xtitle $PWD
       # Echo to screen, if you like
       echo $PWD
       cd $1
       # Cannot write to xterm, just echo to screen
       echo $PWD
alias cd='temp_cd'    
- - - - - - - - - - - - - - - - End ~/.profile - - - - - - - - - - - - - - - - -

I also wanted to tell you about a cool login-notifier I added to /etc/profile after I saw that I had some attempted logins as root while I had my ppp connection up. It broadcasts a message to me whenever anyone other than myself logs in.

- - - - - - - - - - - - - - - Start /etc/profile - - - - - - - - - - - - - - - - 

# Detect logins
UserId=`id -un`
case ${UserId}
  # Don't broadcast when the following user(s) log in:
  mallozzi );;
  # Broadcast for everyone else, especially root
  *) echo "User ${UserId} logged in at `date +%I:%M`" | wall;;
- - - - - - - - - - - - - - - End /etc/profile - - - - - - - - - - - - - - - - -

I also had to put the following in my ~/.profile, to allow the broadcast messages to be displayed:

- - - - - - - - - - - - - - - - snip, snip - - - - - - - - - - - - - - - - 

# Enable write permission to terminal for the automatic login
#  detection procedure (see /etc/profile)
if [ ! "$DISPLAY" ]; then
   chmod 622 $CurrentTerminal
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

See Ya!

-Bob Mallozzi
#define Linux COOL

Date: Tue, 06 Feb 1996 09:24:20 CST
From: Brian Harvey <brian@cs.UCR.edu>
To: <waltz@pcjiw.lampf.lanl.gov>
Subject: XTerm title tricks (cont.)
Cc: <fiskjm@ctrvax.Vanderbilt.Edu>

I recently saw your email message in Linux Gazette Issue #6 in which you present some lines to insert into your .cshrc and .login to get the hostname and current path on the xterm title bar. At the end of the message you mention that you've yet to figure out how to reset the hostname and current path after returning from a rlogin or telnet session (your solution was to run a "renew" command). I have a solution which works very well for me.

I'm using tcsh, and I've setup up the following aliases in my .tcshrc:

alias rlogin "(\rlogin \!^; cd .)"
alias telnet "(\telnet \!^; cd .)"

Whenever I return from a rlogin or telnet session, the "cd ." command is run which updates the title bar (because of your previous alias).

I don't know if !^ can be used with aliases in other shells, but hopefully this helps you out.

BTW the tcsh man page gives an example very similar to your cd alias.

alias cwdcmd 'echo -n "^[]2;${HOST}:$cwd^G^[]1;${HOST}^G"'

in tcsh, whatever "cwdcmd" is, gets run after every cd command automatically.

Brian Harvey                            * brian@cs.ucr.edu 
University of California, Riverside 

Date: Wed, 31 Dec 1969 18:00:00 CST
From: Emilio Lopes <ecl@fnpc21.if.usp.br>
To: <fiskjm@ctrvax.Vanderbilt.Edu>
Subject: Xterm title bar


Can I still give my way to put info dynamically in Xterm's titlebar?

I use bash and here goes the relevant portion of my ~/.bashrc file:

if [ -z "$HOST" ]; then
    export HOST=`hostname`

# The string between quotes is used to put the CWD
# in the Xterm title bar. -- ECL
if [ "$TERM" = "xterm" ]; then
    PROMPT_COMMAND='echo -en "\033]2;${LOGNAME}@${HOST}:${PWD}\007"'

Bash executes "PROMPT_COMMAND" every time it is about to print the prompt (PS1).

The variables LOGNAME and PWD are automatically set by Bash. This does not happen with HOST, which we must set using the "hostname" command.

The "033" is the octal form of decimal 27 = ESC.

I prefer this way because I don't have to alias "cd". Note that the power that the variable PROMPT_COMMAND gives you goes beyond a "simple" title in a Xterm window. You can make it speak something like "Yes sir!" at each prompt... ;-)

Have FUN!


 Emilio C. Lopes
 FINPE, Instituto de Fisica      E-mail: ecl@if.usp.br
 Universidade de Sao Paulo       Phone: (55)(11) 818-6724 (Voice)
 Caixa Postal 66318                     (55)(11) 818-6715 (Fax)
 05389-970  Sao Paulo - SP

Sender: senning@tabasco.math.gordonc.edu
From: "Jonathan R. Senning" <senning@gordonc.edu>
To: fiskjm@ctrvax.Vanderbilt.Edu
Subject: Updating XTerm's Titlebar

I've been wanting to know how to do this for some time now! Thanks for making it available. I'm just sorry that I missed it the first time around...

Here is a minor suggestion that I didn't see mentioned in any other updates in the January issue.

After some fiddling I came up with the following string for PS1:

	PS1="\[\033]2;\h:\w\007\]\$ "

The "\[" at the beginning and the "\]" near the end bracket the non-printing characters. This is important when the editing long command lines. This is documented in the man page for bash.

| Jonathan R. Senning    Assistant Prof. of Mathematics and Computer Science |
| senning@GordonC.EDU  Gordon College, Wenham, MA 01984 (508) 927-2300 x4376 |

Back up to the Linux Gazette!