开发者

Shell script won't run on Android but will on Ubuntu

This script was written to make changes to the build.prop file on rooted devices. It will run on ubuntu but throws the following error when it is ran on a device. 6: Syntax error: expecting "in"

LINE_BREAK=""
while read line
do
    case $line in
        ro.ril.reject.cs.ss.enabled?=*)
            line="ro.ril.reject.cs.ss.enabled=1";;
      开发者_JAVA技巧  ro.ril.reject.mo.ussd.enabled?=*)
            line="ro.ril.reject.mo.ussd.enabled=1";;
        ro.phone.function?=*)
            line="ro.phone.function=0";;
        ro.bt.profiles?=*)
            line="ro.bt.profiles=4270339";;
        service.brcm.bt.ag_supported?=*)
            line="service.brcm.bt.ag_supported=0";;
    esac
    NEW_FILE="$NEW_FILE$LINE_BREAK$line"
    LINE_BREAK="\n"
done </system/build.prop
echo $NEW_FILE>/system/build.prop

Is there a nuance to writing scripts in android that I am missing? Thanks in advance!


You can try writing a script using SL4A which is the scripting layer for android. Reference http://android.amolgupta.in/2011/04/scripting-on-android.html


I do not have an Android but I would try putting quotes around $line:

case "$line" in

Just a hunch. Sorry about that. Maybe you tried already.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜