Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Date prompt expansion
- X-seq: zsh-users 17439
- From: Mark van Dijk <lists+zsh@xxxxxxxxxxxxxx>
- To: "zsh-users@xxxxxxx" <zsh-users@xxxxxxx>
- Subject: Date prompt expansion
- Date: Mon, 26 Nov 2012 12:33:25 +0100
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
Following up on my email sent yesterday where I asked a question about
pcre, the question also implied I'm doing stuff with dates.
Currently I am using two different methods of getting the today's
day/month and yesterday's day/month:
1) for today I'm using prompt expansion:
todaysDay=${(%):-%D{"%d"}} # 26
todaysMonth=${(%):-%D{"%m"}} # 11
2) for yesterday I'm using FreeBSD's date command:
yesterdaysDay=$(/bin/date -v -1d "+%y")
yesterdaysMonth=$(/bin/date -v -1d "+%m")
I'm more fond of the first method. Can the second be done without
calling /bin/date?
Mark
Messages sorted by:
Reverse Date,
Date,
Thread,
Author