Problem with Bash-4 and $(command) syntax

Jerry gesbbb at yahoo.com
Thu Mar 12 07:25:34 PDT 2009


I just updated from Bash-3.x to Bash-4.0. There appears to be a problem
with the way Bash-4 interprits the following.

This works fine on Bash-3.x:
<snippet>
#!/usr/bin/env bash

GET_PATH=1

if $( which gpg2 ); then
   printf "gpg2 located"
fi
</snippet>   
   
However, under Bash-4, it fail with this error message:

./t.sh: command substitution: line 6: syntax error near unexpected
token `)' ./t.sh: command substitution: line 6: ` which gpg2 )'

I have several scripts that use the $(command) syntax and they are all
failing now. I have replaced that syntax with the older "`" tics method.

Is this a known problem with Bash-4? I have not been able to find
anything about it on the Bash site.

-- 
Jerry
gesbbb at yahoo.com


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20090312/122ce8cc/signature.pgp


More information about the freebsd-questions mailing list