Greetings, using ksh on Solaris, I am trying to identify the current version of a package installed on multiple servers using if statement in a precursor to upgrading.
I have searched the forums and have found many hits, reviewed 3 pages and have tried the different variations noted there. Also checked the site, Bourne/Korn Shell Coding Conventions at OpenSolaris.org to validate operators and syntax, yet I am not getting this to work.
I have tried the following variations and all return some error, most commonly:
ksh: 1.11: unknown test operator
no
Am I missing something simple?
if [ echo "`pkginfo -x \`pkginfo | grep libiconv | awk '{print $2}'\` | grep sparc | awk '{print $2}'`" = 1.11 ]
then
echo yes
else
echo no
fi
if [ echo "`pkginfo -x \`pkginfo | grep libiconv | awk '{print $2}'\` | grep sparc | awk '{print $2}'`" eq 1.11 ]
then
echo yes
else
echo no
fi
if [ echo "`pkginfo -x \`pkginfo | grep libiconv | awk '{print $2}'\` | grep sparc | awk '{print $2}'`" eq "1.11" ]
then
echo yes
else
echo no
fi
if [ echo "`pkginfo -x \`pkginfo | grep libiconv | awk '{print $2}'\` | grep sparc | awk '{print $2}'`" -eq "1.11" ]
then
echo yes
else
echo no
fi
if [[ echo "`pkginfo -x \`pkginfo | grep libiconv | awk '{print $2}'\` | grep sparc | awk '{print $2}'`" -eq "1.11" ]]
then
echo yes
else
echo no
fi
if [ echo "\"`pkginfo -x \`pkginfo | grep libiconv | awk '{print $2}'\` | grep sparc | awk '{print $2}'`\"" -eq "1.11" ]
then
echo yes
else
echo no
fi