bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: brace expansion fails in 4.3, succeed in 4.2


From: Dan Douglas
Subject: Re: brace expansion fails in 4.3, succeed in 4.2
Date: Sat, 10 May 2014 23:48:13 -0500
User-agent: KMail/4.13 (Linux/3.14.0-pf3+; KDE/4.13.0; x86_64; ; )

On Saturday, May 10, 2014 03:31:05 PM Dan Douglas wrote: 
>  $ bash -c 'printf -v a "%(%s)T" -1; printf "%(%Y%m%d)T " "$a" 
"${a[a+=60*60*24,0]"{0..8}"}"; echo'
> 20140510 20140511 20140512 20140513 20140514 20140515 20140516 20140517 
20140518 20140519

By the way, I'm not very good at remembering the winking smiley when my 
solutions are not entirely serious, so here it is: ;-)

Also, I didn't notice you meant to count backwards. GNU date has a better 
solution anyway by reading date formats with "-f". The downside is it appears 
to only do newline-delimited input and output. 

$ printf 'now - %d days\n' {0..9} | date -f - +%Y%m%d | tr '\n' ' '; echo
20140510 20140509 20140508 20140507 20140506 20140505 20140504 20140503 
20140502 20140501

-- 
Dan Douglas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]