Prompt changing on the fly
storm at diku.UUCP
storm at diku.UUCP
Sat Jan 24 02:58:56 AEST 1987
In article <432 at ethz.UUCP> wyle at ethz.UUCP (Mitchell Wyle) writes:
>Does anyone out there have a shell script / program to change
>the prompt DYNAMICALLY after each [CR]?
You cannot use a shell script or a program to change the shell prompt
dynamically, because the PS1/prompt variables are local to the shell,
and therefore they can only be changed by the shell itself.
I don't know of any hooks into the Bourne/C shells which enables you to
recognize that CR has been typed, and thus not to execute any commands
in connection with execution of other commands.
BUT you should try out the following 'trick' which gives some of
the functionality you want:
Include the following lines in your .profile (this is Bourne Shell)
or type them in directly if you like:
trap 'PS1="`fortune` > "' 5
while true ; do
sleep 10 ; kill -5 $$
done &
Now watch what happens after the execution of the next command.
This is not exactly what you asked for, but the idea might be of some
use to you.
--
Kim F. Storm, storm at diku.UUCP (via seismo or mcvax or ...)
Institute of Datalogy(=CS), U of Copenhagen, Universitetsparken 1, DK-2100 OE
More information about the Comp.unix.questions
mailing list