[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Documentation issue

From: Eli Barzilay
Subject: Documentation issue
Date: Thu, 26 Oct 2017 01:18:33 -0400

Bash surprised me with the behavior mentioned here:


This can be pretty bad in that it's very unexpected (see the comments).
Also, the surprise can be triggered without nullglob as well:

    $ foo=(a b c)
    $ touch foo0
    $ unset foo[0]
    $ echo ${foo[*]}
    a b c

The thing is that AFAICT, there is no mention of this pitfall in the man
page...  It would be nice to mention using quotes in at least the
`unset` description, and possibly also about `nullglob` too since it
makes it easier to run into this problem.

I grepped through the bash sources, and even there I found a few unsafe

    grep -r 'unset[^a-z"'\'']*\[' examples tests

so this is clearly something that is not well-known enough.

                   ((x=>x(x))(x=>x(x)))                  Eli Barzilay:
                   http://barzilay.org/                  Maze is Life!

reply via email to

[Prev in Thread] Current Thread [Next in Thread]