tech-userlevel archive

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

Re: Deferring variable parse errors in /bin/sh



    Date:        Tue, 13 Jun 2017 06:37:12 +0200
    From:        dieter roelants <dieter.NetBSD%pandora.be@localhost>
    Message-ID:  <CAHTEWP1R7M5WM2AAo1-LzwQibADbqWvYEdjA33VtPj9QEpjgcw%mail.gmail.com@localhost>

  | Would that mean `sh -n` would not complain about it? If so, it seems like a
  | bad idea.

Yes, it would mean that.

And while I was never sure this would be a good thing to do in any case
now, I had already almost convinced myself against it anyway, as while the
example in question (something like)

	${#array[@]}

would be reasonably easy to handle (find the '}' ignore the rest, and
just mark it as a bad expansion, to generate an error if it was ever used)
other cases like perhaps

	${stuff/}/}}/}

are a lot trickier to figure out what to do with, without actually
understanding what is supposed to be happening (nb: I just made that
example up from nowhere, I have no idea if anything like that could ever
actually occur - but nor do I know it could not - which is the point.)

I think we can consider this question answered.

kre



Home | Main Index | Thread Index | Old Index