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.
精彩评论