在if语句中使用大括号的问题。
fileResult=`rsh $nsmHost "find $keyPackagePath -name '*.pgp' -exec ls -ltr '{}' +" | awk '{print $9}' | sort -k1.32`
for i in $fileResult
do
#Extract Minor Version and Major version
keyMajVersion=`echo $i|cut -d '.' -f2 | cut -c19-`
keyMinVersion=`echo $i|cut -d '.' -f3 | cut -d '_' -f1`
if [ -f $versionFile ]
then
majVersion=`cat $versionFile|cut -d '.' -f1`
minVersion=`cat $versionFile|cut -d '.' -f2`
if [ [ $keyMajVersion == `echo "$majVersion + 1" | bc` ] && [ $keyMinVersion = `echo "$minVersion + 1" | bc` ] ] || [ [ $keyMajVersion = $majVersion ] && [ $keyMinVersion" = `echo
"$minVersion + 1" | bc` ] ]
then
#install and Activate
#triggerPollNDeploy
echo "KUM::Version file exist and support next package deploy"
#Update version in VersionFile and break
echo "$keyMajVersion.$keyMinVersion" > $versionFile
fi