Article 6K1SV testif.sh: 10: [: Illegal number: 4.0 - Why I am getting this error even in simple script. M tired. Plz help.

testif.sh: 10: [: Illegal number: 4.0 - Why I am getting this error even in simple script. M tired. Plz help.

by
Vishesh Joshi
from LinuxQuestions.org on (#6K1SV)
#!/bin/bash
#test if else script
cd /root/task
pwd
ab=`du -h | cut -c 1,2,3 | grep 4.0`

echo $ab

if [ $ab -eq "4.0" ]

then
echo "$ab is Rightly fetched."

else
echo "$ab is not correctly fetched."
fi
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments