Problem with Bash-4 and $(command) syntax

Tim Judd tajudd at gmail.com
Fri Mar 13 12:16:10 PDT 2009


On Thu, Mar 12, 2009 at 11:35 PM, bf <bf2006a at yahoo.com> wrote:

>
>
> > > {Problem with Bash-4 and $(command) ...}:
> > [...]
> > > I found the same problem, and have reverted to
> > >  bash3.2 until it's sorted out.
> >
> > See if the following helps.
> >
> > http://tiswww.case.edu/php/chet/bash/COMPAT
> >
> > Especially:
> >
> > 38. Since bash-4.0 now follows Posix rules for finding the
> > closing
> > delimiter of a $() command substitution, it will not behave as > previous
> > versions did, but will catch more syntax and parsing errors
> > before
> > spawning a subshell to evaluate the command substitution.
> >
> > --
> >Eray
>
> Yes, the above is true.  But many of the examples cited
> by people noticing this problem are perfectly valid and
> _should_ work.  The problem is that the port's parser is
> broken, owing in part to incompatibilities between the
> system yacc currently used to build the parser and GNU
> bison, which is used by the people who write bash.  This
> is true of both shells/bash and shells/bash3, but is more
> noticeable in shells/bash.  A fix has been proposed, and patches
> are available, in the follow-up to:
>
> http://www.FreeBSD.org/cgi/query-pr.cgi?pr=ports/101230
>
> The port's maintainer has been reluctant to switch to bison,
> so this may not be the solution that is ultimately used to
> fix the port, but you can use these in the meantime.
>
> Regards,
>             b.
>
>

I'm wondering if a fix can be accomplished due to a semicolon within the ()s
to complete a command line.  Similar to how find(1) expression works, you
have to end the expression with a semicolon in order for find to
successfully (and willingly) work.

Can the OP try
  if $( which gpg2; ); then


And let us know.

My $.02


More information about the freebsd-questions mailing list