TIME-IN-PROMPT

Michael Meissner meissner at tiktok.dg.com
Thu Jul 13 00:16:53 AEST 1989


In article <827 at nsscb.UUCP> nrg at nsscb.UUCP (Narotham Reddy) writes:
| 
| Can any one focus on how to include the "just time" in the prompt(PS1)
| with out running any additonal shell(s) in the back ground. the prompt
| should update the time by itself in the prompt again with out any additonal
| running on it's behalf in the back ground.

Sure, use the GNU Bourne-Again Shell (bash).  Quoting from the
FEATURES file which gives minimal documentation for bash:

	....

Here is the comment next to the decode_prompt_string function.

/* Return a string which will be printed as a prompt.  The string
   may contain special characters which are decoded as follows:
   
	\t	the time
	\d	the date
	\n	CRLF
	\s	the name of the shell
	\w	the last element of the current working directory
	\u	your username
	\h	the hostname upto the first `.'
	\#	the command number of this command
	\<octal> character code in octal
	\\	a backslash
*/

	...

The shell has several variables which are there just for controlling the
behavior of the interactive shell.  Here they are:

	...

PROMPT_COMMAND:
	If present, this contains a string which is a command to execute
	before the printing of each top-level prompt.


Note that bash is currently in beta test, so you might find some bugs,
or your system might not be supported yet.  It is available from the
usual GNU places (anonymous FTP: prep.ai.mit.edu, anonymous UUCP: Ohio
state).  There is a mailing list (and corresponding GNU newsgroup:
gnu.bash.bug) for bash.
--
Michael Meissner, Data General.
Uucp:		...!mcnc!rti!xyzzy!meissner		If compiles were much
Internet:	meissner at dg-rtp.DG.COM			faster, when would we
Old Internet:	meissner%dg-rtp.DG.COM at relay.cs.net	have time for netnews?



More information about the Comp.unix.questions mailing list