[Eug-lug] shell evilness

Neil Parker nparker at LLX.COM
Wed Jul 5 21:45:04 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...

Eh?  As of version 5.2.1, GNU "date" doesn't recognize a "-v" option.
What version of "date" are you using?

Assuming that you want the Perl script to run on the same machine as the
shell script (i.e., the "-v" option is recognized),

     perl -e 'mkdir `date -v+${_}d +%A` foreach 1..6'

                   - Neil Parker


More information about the EUGLUG mailing list