[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: TZ=... date affected PROMPT_COMMAND
From: |
Matthew Woehlke |
Subject: |
Re: TZ=... date affected PROMPT_COMMAND |
Date: |
Wed, 16 Apr 2008 11:41:57 -0500 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.12) Gecko/20080213 Thunderbird/2.0.0.12 Mnenhy/0.7.5.0 |
jidanni@jidanni.org wrote:
Never thought that putting TZ here would infect my prompt,
21:07 ~$ date
Wed Apr 16 21:07:54 CST 2008
21:07 ~$ TZ=America/Chicago date
Wed Apr 16 08:08:07 CDT 2008
08:08 ~$ set a b c
08:08 ~$ date
Wed Apr 16 21:08:22 CST 2008
21:08 ~$
all the way until the next non built-in command.
Need to do sh -c 'TZ=America/Chicago date'
if one doesn't want their prompt affected.
You didn't mention what version of bash you are using. I was unable to
reproduce this on 3.00.15 or 3.2.5.
(On the other hand, what I do in .bashrc is black magic to me too:)
PROMPT_COMMAND='prompt_tricks_z=" $?"; prompt_tricks_z=${prompt_tricks_z# 0}
Well, you could always read the bash manual to decipher the above :-).
I'll leave that as an exercise for you; the function of the above is
actually very straight-forward.
case $PWD in $HOME) pwd=\~;; *) pwd=${PWD##*/};; esac' #cfaj.freeshell.org
This part is unneeded. If I understand it correctly, you could remove
this line and replace '\$pwd' in your PS1 with \W to achieve the same
effect.
--
Matthew
> pinotree uses the large trout on tsdgeos and PutHuhn :)
> PutHuhn runs
> tsdgeos lights a fire and eats the trout
(with apologies to Pino Toscano, PutHuhn and Albert Astals Cid, who came
up with this entirely on their own)
- TZ=... date affected PROMPT_COMMAND, jidanni, 2008/04/16
- Re: TZ=... date affected PROMPT_COMMAND,
Matthew Woehlke <=
- Re: TZ=... date affected PROMPT_COMMAND, Archimerged Ark Submedes, 2008/04/17
- Re: TZ=... date affected PROMPT_COMMAND, jidanni, 2008/04/17
- Re: TZ=... date affected PROMPT_COMMAND, Matthew Woehlke, 2008/04/17
- Re: TZ=... date affected PROMPT_COMMAND, Chet Ramey, 2008/04/17
- Re: TZ=... date affected PROMPT_COMMAND, Matthew Woehlke, 2008/04/17