shell脚本的android给出[:未找到 [英] shell script in android gives [: not found
本文介绍了shell脚本的android给出[:未找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个脚本,适用于我的Linux机器
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
但是当我使用这在Android中,如下所示:
But when I use this in android 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 like:
[: not found
修改
是否有任何其他的逻辑来检查 $ C
的价值,无论是1还是0?
Is there any other logic to check the value of $c
, whether it is 1 or 0 ?
Android的壳有问题的[]中,如果那么有没有检查c的值任何其他方式?
推荐答案
一般 [
的别名测试
在Linux机器的测试是在
in Linux machine test is at
/usr/bin/test
和
if [ $c == 1 ]
被评为
if test "$c" = 1
但是,这里的机器人有没有测试
BUT here in android there is no test
因此,如果用[]将不会在任何情况下工作...
so if with [] will not work in any case...
我将穿越为Android编写的测试,并检查它.... !!!
i will cross compile test for android and check it....!!!
这篇关于shell脚本的android给出[:未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文