Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!seismo!mcvax!diku!storm From: storm@diku.UUCP Newsgroups: comp.unix.questions,comp.unix.wizards Subject: Re: Re: Prompt changing on the fly Message-ID: <2935@diku.UUCP> Date: Fri, 23-Jan-87 11:58:56 EST Article-I.D.: diku.2935 Posted: Fri Jan 23 11:58:56 1987 Date-Received: Sun, 1-Feb-87 16:05:11 EST References: <432@ethz.UUCP> Distribution: world Organization: DIKU, U of Copenhagen, DK Lines: 31 Keywords: prompt Xref: watmath comp.unix.questions:874 comp.unix.wizards:779 In article <432@ethz.UUCP> wyle@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@diku.UUCP (via seismo or mcvax or ...) Institute of Datalogy(=CS), U of Copenhagen, Universitetsparken 1, DK-2100 OE