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 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
EDIT
Is there any other logic to check the value of $c
, whether it is 1 or 0 ?
Android shell have problem with [] in if so is there any other way to check the value of c ?
How about checking that the .sh file doesn't contain a carriage return before line feed.
Windows \r\n -> CR LF
Unix \n -> LF
andriod shell sh is actually a link to busybox, and it is invoked as
you need setup [ applets manually
if you don't know where busybox is put, try list the /system/bin/sh which you give