Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Mar 2009 10:25:23 -0400
From:      Jerry <gesbbb@yahoo.com>
To:        freebsd-questions@freebsd.org
Subject:   Problem with Bash-4 and $(command) syntax
Message-ID:  <20090312102523.6f5ad248@scorpio>

next in thread | raw e-mail | index | archive | help
--Sig_/CWETOEq.heNAgahB2DxxYLS
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

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=3D1

if $( which gpg2 ); then
   printf "gpg2 located"
fi
</snippet>  =20
  =20
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.

--=20
Jerry
gesbbb@yahoo.com



--Sig_/CWETOEq.heNAgahB2DxxYLS
Content-Type: application/pgp-signature; name=signature.asc
Content-Disposition: attachment; filename=signature.asc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (FreeBSD)

iEYEARECAAYFAkm5G1sACgkQBvaKIJWWCO2DLwCeIWK5Hn1gnHliPHajtmPBOeUG
Dj4An1725D+MLKmmXbX2V4LZll/j5Ne3
=6uLu
-----END PGP SIGNATURE-----

--Sig_/CWETOEq.heNAgahB2DxxYLS--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090312102523.6f5ad248>