Tweeted twitter.com/StackUnix/status/749648873757536256
3 assuming the backticks around the 4.1.1 in the error output was gratuitous formatting and not actual output
source | link

I am making the check for update script for my theme

iI have 2 txttext files. First one is called "current.txt" containand contains the current version. There is 4.1.1 string in that txttext file.

Second one is called "latest.txt" containand contains the latest version. There is 4.2 string in this txttext file.

So here is the code

echo "Checking update";
x=$(cat ./current.txt)
y=$(cat ./latest.txt)
if [ "$x" -eq "$y" ]
then
       echo There is version $y update
else
       echo Version $x is the latest version
fi

What it mean is if current.txt is NOT the same with latest.txt then it will say "there is version 4.2 update". If not, it will say "version 4.1.1 is the latest version"

But when iI try to run it. I get this error

Checking update
./test.sh: line 4: [: `44.1.1`1: integer expression expected
Version 4.1.1 is the latest version

So what am iI doing wrong with this?

I am making the check for update script for my theme

i have 2 txt. First one is called "current.txt" contain current version. There is 4.1.1 string in that txt file

Second one is called "latest.txt" contain latest version. There is 4.2 string in this txt file

So here is the code

echo "Checking update";
x=$(cat ./current.txt)
y=$(cat ./latest.txt)
if [ "$x" -eq "$y" ]
then
       echo There is version $y update
else
       echo Version $x is the latest version
fi

What it mean is if current.txt is NOT the same with latest.txt then it will say "there is version 4.2 update". If not, it will say "version 4.1.1 is the latest version"

But when i try to run it. I get this error

Checking update
./test.sh: line 4: [: `4.1.1`: integer expression expected
Version 4.1.1 is the latest version

So what am i doing wrong with this?

I am making the check for update script for my theme

I have 2 text files. First one is called "current.txt" and contains the current version. There is 4.1.1 string in that text file.

Second one is called "latest.txt" and contains the latest version. There is 4.2 string in this text file.

So here is the code

echo "Checking update";
x=$(cat ./current.txt)
y=$(cat ./latest.txt)
if [ "$x" -eq "$y" ]
then
       echo There is version $y update
else
       echo Version $x is the latest version
fi

What it mean is if current.txt is NOT the same with latest.txt then it will say "there is version 4.2 update". If not, it will say "version 4.1.1 is the latest version"

But when I try to run it. I get this error

Checking update
./test.sh: line 4: [: 4.1.1: integer expression expected
Version 4.1.1 is the latest version

So what am I doing wrong with this?

2 added 4 characters in body
source | link

I am making the check for update script for my theme

i have 2 txt. First one is called "current.txt" contain current version. There is 4.1.1 string in that txt file

Second one is called "latest.txt" contain latest version. There is 4.2 string in this txt file

So here is the code

echo "Checking update";
x=$(cat ./current.txt)
y=$(cat ./latest.txt)
if [ "$x" -eq "$y" ]
then
       echo There is version $y update
else
       echo Version $x is the latest version
fi

What it mean is if current.txt is NOT the same with latest.txt then it will say "there is version 4.2 update". If not, it will say "version 4.1.1 is the latest version"

But when i try to run it. I get this error

Checking update
./test.sh: line 4: [: `4.1.1`: integer expression expected
Version 4.1.1 is the latest version

So what am i doing wrong with this?

I am making the check for update script for my theme

i have 2 txt. First one is called "current.txt" contain current version. There is 4.1.1 string in that txt file

Second one is called "latest.txt" contain latest version. There is 4.2 string in this txt file

So here is the code

echo "Checking update";
x=$(cat ./current.txt)
y=$(cat ./latest.txt)
if [ "$x" -eq "$y" ]
then
       echo There is version $y update
else
       echo Version $x is the latest version
fi

What it mean is if current.txt is the same with latest.txt then it will say "there is version 4.2 update". If not, it will say "version 4.1.1 is the latest version"

But when i try to run it. I get this error

Checking update
./test.sh: line 4: [: `4.1.1`: integer expression expected
Version 4.1.1 is the latest version

So what am i doing wrong with this?

I am making the check for update script for my theme

i have 2 txt. First one is called "current.txt" contain current version. There is 4.1.1 string in that txt file

Second one is called "latest.txt" contain latest version. There is 4.2 string in this txt file

So here is the code

echo "Checking update";
x=$(cat ./current.txt)
y=$(cat ./latest.txt)
if [ "$x" -eq "$y" ]
then
       echo There is version $y update
else
       echo Version $x is the latest version
fi

What it mean is if current.txt is NOT the same with latest.txt then it will say "there is version 4.2 update". If not, it will say "version 4.1.1 is the latest version"

But when i try to run it. I get this error

Checking update
./test.sh: line 4: [: `4.1.1`: integer expression expected
Version 4.1.1 is the latest version

So what am i doing wrong with this?

1
source | link

Bash - Integer expression expected

I am making the check for update script for my theme

i have 2 txt. First one is called "current.txt" contain current version. There is 4.1.1 string in that txt file

Second one is called "latest.txt" contain latest version. There is 4.2 string in this txt file

So here is the code

echo "Checking update";
x=$(cat ./current.txt)
y=$(cat ./latest.txt)
if [ "$x" -eq "$y" ]
then
       echo There is version $y update
else
       echo Version $x is the latest version
fi

What it mean is if current.txt is the same with latest.txt then it will say "there is version 4.2 update". If not, it will say "version 4.1.1 is the latest version"

But when i try to run it. I get this error

Checking update
./test.sh: line 4: [: `4.1.1`: integer expression expected
Version 4.1.1 is the latest version

So what am i doing wrong with this?