[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: unbalanced parenthesis not recognized
From: |
Greg Wooledge |
Subject: |
Re: unbalanced parenthesis not recognized |
Date: |
Thu, 18 Nov 2021 09:57:54 -0500 |
On Thu, Nov 18, 2021 at 10:34:40AM +0100, Harald Dunkel wrote:
> Hi folks,
>
> I am not sure, but shouldn't bash 5.1.4 complain about
>
> : ${SSLDIR}:="${JM_WORK}/ssl"}
There's no syntax error here. It may be a bug, in the sense that it
doesn't do what you wanted it to do, but from the shell's point of
view, it's a valid command.
You've got ${SSLDIR} which is a parameter expansion, not quoted.
You've also got ${JM_WORK} which is another parameter expansion, this
time inside quotes. In addition, you've got the literal character
strings := and /ssl and } which are just extra text.
The resulting command, after expansions, may look something like
this:
: /foo/bar:=/home/jm/work/ssl}
This command has no effect.
> at least due to unbalanced parenthesis? The correct version
> would be
>
> : ${SSLDIR:="${JM_WORK}/ssl"}
That's a very different command indeed. That one potentially modifies
the value of the SSLDIR variable.