How do I ... (NOT a FAQ)
Anita Hsiung
mars at athena.mit.edu
Thu Mar 7 02:40:33 AEST 1991
In article <506 at bria> uunet!bria!mike writes:
>In an article, mindcraft.com!ronnie (Ronnie Kon) writes:
>>In article <15710 at mendip.UUCP> mhr at mendip.UUCP (Mark Hull-Richter) writes:
>>>
>>>How do I get the current time into my command line prompt?
>>>
>> The construct `command` (note the use of accent grave (`) instead
>>of apostrophe (') inserts the result of the command into the command line.
(stuff deleted)
>If you happened to read the question, the original poster was NOT asking how
>to insert the date into the command line -- he was asking how to insert the
>date in the command line *prompt*.
>
>The answer is: it depends. Some shells allow for the execution of embedded
>commands in a prompt; the Big Three (sh, csh, ksh) do not.
I use csh and it works for me. My prompt definition looks like:
set prompt="{!} (labs-n) `date +%T`${cwd}% "
resulting in:
{43} (labs-n) 11:36:13 /usr/ahsiung%
Of course, the time only updates when I "cd".
-- Anita --
More information about the Comp.unix.wizards
mailing list