The shell script in Android gives [: not found

I have this script that can run on my Linux machine

#!/bin/sh
c=1
if [ $c == 1 ]
then
  echo c is 1
else
  echo c is 0
fi

But when I use it in Android, it's as follows:

#!/system/bin/sh
c=1
if [ $c == 1 ]
then
  echo c is 1
else
  echo c is 0
fi

It gives an error:

[: not found

edit

Is there any other logic that can check the value of $C, whether it is 1 or 0?

The Android shell has a problem with []. If so, is there any other way to check the value of C?

resolvent:

The Android shell SH is actually a pointer busy@R_ 658_ 2419 @ link, which is called as

busy@R_658_2419@ sh

You need to set up [applets manually

busy@R_658_2419@ ln -s /your_original_sh_path/busy@R_658_2419@ [ 

If you don't know busy@R_ 658_ 2419 @ location, please try to list the / system / bin / sh you provided

ls /system/bin/sh
busy@R_658_2419@ which busy@R_658_2419@

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>