euglug.org

[Eug-lug] shell evilness

작성자

카테고리:



Allen BrownWed Jul 5 22:23:27 PDT 2006

larry price wrote:
> mkdir $(for d in 1 2 3 4 5 6; do eval "date -v+${d}d +%A";done)
> 
> challenge to the perl monks; do the same thing in fewer characters...

I would do it in shell in fewer characters.
for d in 1 2 3 4 5 6; do mkdir `date -v+${d}d +%A`; done

or
mkdir $(for d in 1 2 3 4 5 6; do date -v+${d}d +%A; done)

Only problem is that I don't know what the -v option does.
So the format string doesn't work.  But the shell part does.
-- 
Allen Brown  abrown at peak.org  http://www.peak.org/~abrown/
   You can lead a horticulture but you can't make her think. ---Dorothy 
Parker