Hi,
I improved the script to fulfill the author's the expectation(just display time
for today's mails),
only 'if condition' changed.
- du yang
============================
#!/bin/bash
epoch="$1"
if [ $(date -d "$(date '+%Y-%m-%d')" "+%s") -gt $epoch ]; then
echo "%4C %Z %{%d.%m.%y} %-15.15F (%?l?%4l&%4c?) %?H?[%H]?%s%"
else
echo "%4C %Z %{ %H:%M} %-15.15F (%?l?%4l&%4c?) %?H?[%H]?%s%"
fi
On Thu, Jan 06, 2011 at 00:38 +0100, Andreas Kneib wrote:
> Hi,
>
> * Yue Wu schrieb am Donnerstag, den 06. Januar 2011:
>
> > Is there a date/time string that show the time only for today's emails
> > but date for else? So, in the index, the emails that got today will
> > show the time only, but the ones that got on other days will show the
> > date and time.
>
> I use this script:
> http://groups.google.com/group/de.comm.software.mailreader.misc/browse_thread/thread/ab966bddc0b42446/421549103438b830?q=#421549103438b830
>
> In ~/.muttrc:
> #v+
> set index_format="./format_date.sh '%[%s]' |"
> #v-
>
> #############################
> #!/bin/bash
> #
> # File: format_date.sh
>
> epoch="$1"
>
> if [ $(($(date '+%s') - $1)) -gt 86400 ]; then
> echo "%4C %Z %{%d.%m.%y} %-15.15F (%?l?%4l&%4c?) %?H?[%H]?%s%"
> else
> echo "%4C %Z %{ %H:%M} %-15.15F (%?l?%4l&%4c?) %?H?[%H]?%s%"
> fi
> #############################
>
>
> Andreas
--