Path: utzoo!news-server.csri.toronto.edu!rutgers!uwm.edu!zaphod.mps.ohio-state.edu!think.com!mintaka!bloom-picayune.mit.edu!athena.mit.edu!mars From: mars@athena.mit.edu (Anita Hsiung) Newsgroups: comp.unix.wizards Subject: Re: How do I ... (NOT a FAQ) Message-ID: <1991Mar6.164033.8173@athena.mit.edu> Date: 6 Mar 91 16:40:33 GMT References: <15710@mendip.UUCP> <668118083.19530@mindcraft.com> <506@bria> Sender: news@athena.mit.edu (News system) Distribution: usa Organization: Massachusetts Institute of Technology Lines: 28 In article <506@bria> uunet!bria!mike writes: >In an article, mindcraft.com!ronnie (Ronnie Kon) writes: >>In article <15710@mendip.UUCP> mhr@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 --