What time is it?
Gene Collins
collins at gene3.ait.iastate.edu
Wed Feb 19 11:20:26 EST 2003
Hi. The \t option for the PS1 variable doesn't know anything about the
tz variable. Try substituting `date`. This will give you more than you
want, since the date will also be printed, but it will use the TZ
variable. The disadvantage is that the date command will run evry time
you get a new prompt.
Remember to include the accent marks in the above `date` syntax.
Gene
>Your e-mail's time stamp also reflects the eastern time zone as well.
>If this TZ environment variable is set when you login with a startup
>file like .profile does it make any difference? I also wonder how your
>hardware clock is set (UTC or local time)? I assume if this box is
>strictly linux, you would be using UTC; I just ask this wondering if
>it might impact how the TZ environment variable behaves.
>
>Wow! I just shelled out of composing this message to mess around with
>the TZ variable on my slackware box and was I in for a treet!:) When I
>first echoed the variable, I thought it was blank (my machine is set
>for localtime instead of UTC because I dual boot.) I kept getting
>times 7 hours ahead of our current time until I set the TZ to MST to
>get local time appearing. Might want to play with the hwclock command
>a bit, perhaps that might have to be set each time one changes time
>zones. I also looked in /usr/share/zoneinfo and found a symbolic link
>to /etc/localtime; the base name of this link is also called
>localtime. Inspecting this file revealed that it was a binary file
>but it seemed to look like the binary file called MST in this zoneinfo
>directory. Right now, I don't know exactly how this plays into the
>whole time setting business but wonder if this would have to be
>changed every time you change timezones. Maybe everything eoesn't
>look at the TZ variable like we expect it to.
>
>Sorry for so much rambling here but this looks like an interesting
>question and an opportunity to confuse others with a convoluted answer:).
>
>On Mon, Feb 17, 2003 at 10:50:46PM -0500, Janina Sajka wrote:
>> I'm one of those folks who likes to set her bash prompt in a particular
>> way. My [particular thing is to have the time provided in the prompt.
>> Ofr course, that's only the time as of when the command prompt is
>> returned, but that is actually helpful to me. In part, I like this
>> because I travel a good deal, and it's useful to have the current local
>> time displayed frequently.
>>
>> Problem is, it doesn't work. It used to, but no longer, and I don't know
>> exactly when or how it got broken.
>>
>> Some facts:
>>
>> I'm running Red Hat 8.0 (fully updated). That's bash version:
>>
>> GNU bash, version 2.05b.0(1)-release (i686-pc-linux-gnu)
>> I have the following prompt string defined:
>>
>> PS1="[\u@\h \t] \W\\\$"
>>
>> And, indeed, this displays the current time. But, it doesn't track time
>> zone changes. For example, I'm currently writing from L.A., so I have:
>>
>> export "TZ=US/Pacific" #Pacific Time
>>
>>
>> And, indeed, issuing the 'date' command reflects this:
>>
>> Mon Feb 17 19:19:38 PST 2003
>> [janina at toccata 22:19:38] janina$
>>
>> But, as you can plainly see, the prompt comes back in Eastern Time, not
>> Pacific. What's wrong? How do I fix it?
>>
>> Or, am I supposed to stay home and not miss blizzards?? <grin>
>>
>>
>> --
>>
>> Janina Sajka, Director
>> Technology Research and Development
>> Governmental Relations Group
>> American Foundation for the Blind (AFB)
>>
>> Email: janina at afb.net Phone: (202) 408-8175
>>
>> _______________________________________________
>> Speakup mailing list
>> Speakup at braille.uwo.ca
>> http://speech.braille.uwo.ca/mailman/listinfo/speakup
>
>--
>Please avoid sending me Word or PowerPoint attachments.
> See http://www.fsf.org/philosophy/no-word-attachments.html
>
>_______________________________________________
>Speakup mailing list
>Speakup at braille.uwo.ca
>http://speech.braille.uwo.ca/mailman/listinfo/speakup
More information about the Speakup
mailing list