On Thu, 08 Sep 2016, Evan Gates <evan.ga...@gmail.com> wrote:
> No. $@ is another example of something that _must_ be quoted every
> time. When inside quotes the shell expands it correctly to a word for
> each parameter. Without quotes the shell will do extra word splitting
> and globbing. For example, try this:
>
> nargs() { echo "$#"; }
> set -- foo 'bar baz'
> echo "$#"
> nargs "$@"
> nargs $@
>
> When in a case statement should you not quote? I can't think of any examples.

Wow, shell quoting is just fucked up crazy. I was mostly using unquoted
$@ my whole life. And here I thought I knew enough not to screw up a
simple script, but there just always seems to be a new hidden gotcha.

Perhaps we should start with a simple, minimalistic list of allowed
constructs, and make it a policy to use rc/c for anything else?

(Also, isn't this how C++ was finally outlawed here? long long time ago?
People trying to agree which subset was "sane" and ultimately deciding
none of it was?)

<3,K.

Reply via email to