Re: Shell hate (was Re: unzip hate)

[prev] [thread] [next] [lurker] [Date index for 2007/02/20]

From: Martin Ebourne
Subject: Re: Shell hate (was Re: unzip hate)
Date: 17:27 on 20 Feb 2007
Smylers <Smylers@xxxxxxx.xxx> wrote:
> A shell which expands a pattern if it can or otherwise (silently)
> pretends that you quoted it is hateful.

Ever so.

> Bash 3 introduced the failglob option

Hey, bash wasn't first. :)

> (Don't confuse this with the nullglob option, which (silently) pretends
> that non-matching patterns never existed, running the command with
> nothing in the place where you typed the pattern; that's also hateful.)

That's especially evil. You could be waiting for grep for a very long time. =
:)

failglob can be a real pain in scripts. Zsh works well, you can set =20
failglob then give the glob expression a modifier when required. So =20
you can do
   rm -f *.o(N)
and it won't fail on you.

Oh I want to hate GNU find at this point.
    find -name '*.bak'
isn't valid on traditional unix find. On GNU it is, it works from cwd =20
instead. Also you can give many roots for it to search from. I don't =20
really hate that but I do hate that it's different from unix find and =20
that it caught me out. Something like
    find /path/to/dir/*.bak -mtime 5 | xargs rm -f
broke free on my system when there were no .bak files, and started =20
from / as root. Needless to say the system died sometime after the =20
contents of /lib had been erased. Really I suppose I hate my own =20
stupid script (long since beaten to death) for being stupid and badly =20
written. failglob would have saved me. But still GNU find did a whole =20
lot of what I didn't expect it to do. Hate.

Cheers,

Martin.
There's stuff above here

Generated at 06:02 on 21 Feb 2007 by mariachi 0.52