[Eug-lug] shell evilness

larry price laprice at gmail.com
Wed Jul 5 22:51:20 PDT 2006


a. the -v option adjusts the time to be displayed
date -v+1d +%A
prints tomorrows weekday name.

Neil is correct in pointing out that current versions of GNU coreutils
do not support the -v option, I was running it on a FreeBSD box, which
uses the freebsd version of the command.

I'm somewhat curious to know why GNU decided to drop the -v option as
it can be quite useful.

b. there was a bug in the original post; it should have been 1..7 to
cover the entire week.

c. there is only one day of the week that it actually generates days
in lexicographical order; on the other six days the ouput of 'ls' and
'ls -t' will differ (assuming you ran the command in an empty
directory)



On 7/5/06, Allen Brown <abrown at peak.org> wrote:
> 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
> _______________________________________________
> EUGLUG mailing list
> euglug at euglug.org
> http://www.euglug.org/mailman/listinfo/euglug
>


More information about the EUGLUG mailing list