Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Useful zsh/datetime things
- X-seq: zsh-users 6730
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Useful zsh/datetime things
- Date: Wed, 22 Oct 2003 15:31:51 +0000
- In-reply-to: <1031009172754.ZM10491@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <1031009172754.ZM10491@xxxxxxxxxxxxxxxxxxxxxxx>
On Oct 9, 5:27pm, Bart Schaefer wrote:
}
} function rfcdate {
} # Like GNU "date -R"
} strftime "%a, %e %b %Y %H:%M:%S %z" $EPOCHSECONDS
} }
As this doesn't work without a version of strftime that supports the
nonstandard "%z", here's a replacement:
function rfcdate {
# As much like GNU "date -R" as possible
if [[ ${(%):-"%D{%z}"} == [-+]<-> ]]
then strftime "%a, %e %b %Y %H:%M:%S %z" $EPOCHSECONDS
else strftime "%a, %e %b %Y %H:%M:%S %Z" $EPOCHSECONDS
fi
}
The quotes around "%D{%z}" are necessary lest zsh interpret the first
closing brace as the end of the parameter substitution (leaving a stray
second closing brace which becomes part of the comparison). This does
not seem to be the behavior of other shells -- e.g., bash balances all
nested braces.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author