[: argument expected
I was getting the above error while creating a shell script like for example:
for datos in `ls -rt $UNXLOG/26-Jan*`
do
export arch=`echo $datos |cut -d, -f1`
if [ `grep -c INACTIVO ${arch}` -eq 0 ]
then
export linea1=`grep Debut ${arch}`
export horatot=`echo $linea1 |cut -d' ' -f5`
export hora=`echo $horatot |cut -c1-2`
if [ ${hora} -le 19 ]
then
echo "Listando log - ${arch} ...\n" >> $UNXLOG/qq.log
more ${arch} >>$UNXLOG/qq.log
echo "--------------------------------------------------------------------------------" >>$UNXLOG/qq.log
fi
fi
done
The problem is that hora has no value at all. Put a
echo hora = $hora
in front of the if statement to see that. This means that the if statement is just:
Code:
if [ -le 19 ]
One solution is to expand hora with a default value:
if [ ${hora:-1} -le 19 ]
Now if hora is unset or set to null, the if statement will see 1.
References:
http://www.unix.com/unix-dummies-questions-answers/16696-test-argument-expected-error.html { accessed on apr 11 2011 }
best one i gained some ideas form this topics.thanks for shared your post
ReplyDeleteFull Stack Training in Chennai | Certification | Online Training Course | Full Stack Training in Bangalore | Certification | Online Training Course | Full Stack Training in Hyderabad | Certification | Online Training Course | Full Stack Training in Pune | Certification | Online Training Course | Full Stack Training | Certification | Full Stack Online Training Course
It is amazing post!!! You have been helping many application.
ReplyDeleteDevOps Training in Bangalore | Certification | Online Training Course institute | DevOps Training in Hyderabad | Certification | Online Training Course institute | DevOps Training in Coimbatore | Certification | Online Training Course institute | DevOps Online Training | Certification | Devops Training Online
For tips on strong passwords, check out this article here. Most Popular WiFi Hacking Software and Tools. There are certain tools out there that hackers use WiFi Password Hacking Software
ReplyDeleteHitman Pro crack is a software that helps to find malware and also destroys the malware for the better performance of the operating system., Hitman Pro Crack
ReplyDelete