shell script in android gives [: not found

前端 未结 8 1323
一个人的身影
一个人的身影 2021-01-20 23:31

I have this script which works 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 this in

8条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-21 00:20

    generally [ is an alias for test,

    in Linux machine test is at

    /usr/bin/test
    

    and

    if [ $c == 1 ]
    

    is evaluated as

    if test "$c" = 1
    

    BUT here in android there is no test

    so if with [] will not work in any case...

    i will cross compile test for android and check it....!!!

提交回复
热议问题