Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Date prompt expansion



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