[TriLUG] BASH Question: Putting relative local time and user environment v ariables in the prompt

Jaimie Livingston Jaimie.Livingston at haht.com
Fri Sep 27 16:26:42 EDT 2002


Here's the situation...
I have an OpenBSD system that is used by several staffers in the US and
Europe. 
The server is set to use GMT as the localtime, but I would like to have a
bash prompt that displays the users time for their timezone.
 
I assume, possibly incorrectly, that I will have to set the TZ environ
variable for the user via a login script, and then use /t (or /T, or /@) to
display the time in the prompt, and echo the setting for the TZ environ
variable to indicate their timezone.
 
I have two problems:
1) I can't figure out which dot file I should set the TZ prompt from.
   I've tried the following (assuming US Eastern as the timezone):
        in .bashrc and .bash_profile
                        TZ=:/US/Eastern 
        and
            TZ=/usr/share/zoneinfo/US/Eastern
 
                in .login and .profile
                        TZ=:/US/Eastern
                        export TZ
                and
            TZ=/usr/share/zoneinfo/US/Eastern
            export TZ
 
    But to no avail. The time is still returned using GMT as set with
/etc/localtime.
    Perhaps I am misreading the various Bash HOWTO's...
 
2) I don't know how to echo the TZ environment variable in a prompt, can't
find a reference for doing it, and don't even know if it's possible... Any
information you can provide would be helpful...
 
Thanks,
 
Jaimie Livingston
jaimie.livingston(at)haht.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.trilug.org/pipermail/trilug/attachments/20020927/355e2226/attachment.html>


More information about the TriLUG mailing list