From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19018 invoked by alias); 26 Nov 2012 12:38:25 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17441 Received: (qmail 21981 invoked from network); 26 Nov 2012 12:38:12 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at internecto.net designates 176.9.245.29 as permitted sender) X-Virus-Scanned: Debian amavisd-new at mail.internecto.net Message-ID: <50B362AC.4000203@internecto.net> Date: Mon, 26 Nov 2012 13:38:04 +0100 From: Mark van Dijk User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121028 Thunderbird/16.0.2 MIME-Version: 1.0 To: zsh-users@zsh.org Subject: Re: Date prompt expansion References: <50B35385.8040409@internecto.net> <20121126114659.7ec8f1a8@pwslap01u.europe.root.pri> In-Reply-To: <20121126114659.7ec8f1a8@pwslap01u.europe.root.pri> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit > zmodload zsh/datetime > strftime -s yesterdaysDay "+%d" $(( EPOCHSECONDS - 24 * 60 * 60 )) Great, I'll give this a go. Thanks! I noticed something odd when I was trying to fill an associated array with these prompt expansions and the behaviour replicates into non-array variable assignments too. I suspect this is caused by a bug somewhere.. Kind regards, Mark ===== typeset -A datetime DATETIME DateTime dATEtIME datetime=("month" "${(%):-%D{"%m"}}" "day" "${(%):-%D{"%d"}}" "ymdt" "${(%):-%D{"%y%m%dT%H:%M"}}") DATETIME=("month" "${(%):-%D{%m}}" "day" "${(%):-%D{%d}}" "ymdt" "${(%):-%D{%y%m%dT%H:%M}}") DateTime=("month" ${(%):-%D{"%m"}} "day" ${(%):-%D{"%d"}} "ymdt" ${(%):-%D{"%y%m%dT%H:%M"}}) dATEtIME=("month" ${(%):-%D{%m}} "day" ${(%):-%D{%d}} "ymdt" ${(%):-%D{%y%m%dT%H:%M}}) monthday="${(%):-%D{"%m%d"}}" MONTHDAY="${(%):-%D{%m%d}}" MonthDay=${(%):-%D{"%m%d"}} mONTHdAY=${(%):-%D{%m%d}} for i (${(k)datetime}) echo "datetime[$i]: ${datetime[$i]}" for i (${(k)DATETIME}) echo "DATETIME[$i]: ${DATETIME[$i]}" for i (${(k)DateTime}) echo "DateTime[$i]: ${DateTime[$i]}" for i (${(k)dATEtIME}) echo "dATEtIME[$i]: ${dATEtIME[$i]}" echo "monthday: $monthday" echo "MONTHDAY: $MONTHDAY" echo "MonthDay: $MonthDay" echo "mONTHdAY: $mONTHdAY" ===== Output: datetime[ymdt]: 121126T13:35} datetime[day]: 26} datetime[month]: 11} DATETIME[ymdt]: 121126T13:35} DATETIME[day]: 26} DATETIME[month]: 11} ^ notice the } at the end DateTime[ymdt]: 121126T13:35 DateTime[day]: 26 DateTime[month]: 11 dATEtIME[ymdt]: 121126T13:35 dATEtIME[day]: 26 dATEtIME[month]: 11 ^ correct monthday: 1126} MONTHDAY: 1126} MonthDay: 1126 mONTHdAY: 1126 ^ same thing for normal variable assignment