Personalized Prompts

Scott Smith scott at apollo.drexel.edu
Tue Dec 12 03:36:24 AEST 1989


I have been trying to design a prompt that includes the time of day, which
I have found to be useful in some situations (for instance, if you are
waiting for a process to complete, you can glance at the command line to
see when the command was executed; and if somebody leaves a terminal idle
but logged in, you can see instantly how long they have been gone [thereby
gaioning possible justification for kicking them off and taking over that
terminal - this is somthing that I found very useful at my previous job,
where one of my co-workers frequently left terminals idle for days at a
time, but never logged out]).  In any case, what I describe is very easy
to accomplish on an iris workstation (which, I believe, runs system V
unix), but I have been unable to accomplish this on a sun workstation.
The two methods that I know of to do this on the iris are:

	set prompt = " `date +%T` : "
	set prompt = " \@T : "

Both of these definitions, if used on the iris, will produce a prompt
consisting of the current time (in the form hh:mm:ss), followed by a
space, followed by a colon.  The date is updated with each new prompt
(after every carriage return).  I have tried using these on the sun.  The
first method produces a prompt which is the date at the time that the
prompt was set and which remains fixed.  The second produces a prompt of
the form ' \@T : '.  Neither of these is very useful.  The problem seems
to be that the iris operating system evaluates the prompt every time it is
generated, while the sunOS evaluates it only once.  The only exception I
can find is the \! format, which inserts the number of the command into
the prompt, and which is continually updated.  Does anybody know of any
way to force the re-evaluation of the prompt under sun's operating system?
Is there any way to accomplish what I am trying to do?  Any suggestions
would be appreciated.  (By the way, I HAVE checked the manuals, but have
been unable to find anything helpful.)

	Scott Smith
	scott at apollo.drexel.edu



More information about the Comp.sys.sun mailing list