bug-bash
[Top][All Lists]
Advanced

[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: Mon, 22 Nov 2021 07:39:45 -0500

On Mon, Nov 22, 2021 at 09:03:39AM +0100, Harald Dunkel wrote:
> > : ${SSLDIR}:="${JM_WORK}/ssl"}

> Surely I can just speak for myself, but to me it appears obvious that
> there is something weird and that there is one closing bracket too much
> in this line. I understand that bash doesn't produce an error about the
> entire line, because it is valid bash code.

Sure, a human (programmer) looking at this command might be able to
spot the error and guess what the intended command was.

Bash itself can't.  As you said, it's a valid command, so bash has no
reason to complain about it.

Maybe what you want is a "linter" (e.g. shellcheck).  Using the online
version <https://www.shellcheck.net/> gives me this result:

-------------------------------------------------------------------
Line 1:
: ${SSLDIR}:="${JM_WORK}/ssl"}
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a 
shebang or a 'shell' directive.
  ^-- SC2086 (info): Double quote to prevent globbing and word splitting.
                             ^-- SC1083 (warning): This } is literal. Check 
expression (missing ;/\n?) or quote it.

Did you mean: (apply this, apply all SC2086)
: "${SSLDIR}":="${JM_WORK}/ssl"}
-------------------------------------------------------------------

That's not too bad.  Better than I expected, actually.  The suggested
correction at the end isn't helpful, but the SC1083 warning in the
middle is.



reply via email to

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