Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!spool.mu.edu!uunet!ddtisvr.ddtg.com!pechner From: pechner@ddtg.com (Michael Pechner) Newsgroups: comp.unix.wizards Subject: Re: How do I ... (NOT a FAQ) Message-ID: <1991Apr18.162928.29027@ddtg.com> Date: 18 Apr 91 16:29:28 GMT References: <15710@mendip.UUCP> <668118083.19530@mindcraft.com> <506@bria> Sender: news@ddtg.com Distribution: usa Organization: DuPont Design Technologies Group Lines: 37 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. >>(Refer to the man page for your shell for a more complete explanation). I >>believe this facility is present in Bourne shell; I know it is in C and Korn >>shells. > >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. > >-- In ksh I have a function to put in your .kshrc file that will insert time, or other if you want. Most ksh people know about this one. unalias cd function _cd { cd $@ ; PS1=`date '+%H:%M '``hostname`".""$LOGNAME"" ""$PWD"">" export PS1 } alias cd='_cd' My prompt prints "hh:mm mikey.pechner /whatewver/idunno>" -- pechner@mikey.ddtg.com (Michael Pechner) | Pizza Probably The Worlds Most DuPont Design Technologies Group | Perfect Food. Santa Clara, Ca | Carbo, Meat, Dairy, And Veggie | All Food Groups In One.