bash - Android sh script array issue -
bash - Android sh script array issue -
ok, unsure doing wrong here?
i maintain getting [#]: not found
error each of these lines. trying create array of properties , values, can loop on them , either update, or write build.prop
file.
#!/system/bin/sh # prop , prop value variable arrays proparr=; propvalarr=; #properties alter array proparr[] = net.tcp.buffersize.default; proparr[] = net.tcp.buffersize.wifi; proparr[] = net.tcp.buffersize.umts; proparr[] = net.tcp.buffersize.gprs; proparr[] = net.tcp.buffersize.edge; proparr[] = wifi.supplicant_scan_interval; proparr[] = ro.home_app_adj; proparr[] = dalvik.vm.dexopt-flags; proparr[] = dalvik.vm.execution-mode; proparr[] = dalvik.vm.heapstartsize; proparr[] = dalvik.vm.heapgrowthlimit; proparr[] = dalvik.vm.heapsize; proparr[] = dalvik.vm.heaptargetutilization; proparr[] = dalvik.vm.heapminfree; proparr[] = dalvik.vm.heapmaxfree; proparr[] = debug.sf.hw; #property values propvalarr[] = 4096,87380,256960,4096,16384,256960; propvalarr[] = 4096,87380,256960,4096,16384,256960; propvalarr[] = 4096,87380,256960,4096,16384,256960; propvalarr[] = 4096,87380,256960,4096,16384,256960; propvalarr[] = 4096,87380,256960,4096,16384,256960; propvalarr[] = 300; propvalarr[] = 1; propvalarr[] = m=y,v=n,o=v,u=n; propvalarr[] = init:jit; propvalarr[] = 16m; propvalarr[] = 128m; propvalarr[] = 512m; propvalarr[] = 0.75; propvalarr[] = 12m; propvalarr[] = 16m; propvalarr[] = 1;
i cannot utilize bash
due beingness used on android device
# variable place holder future line number of prop values linenum= # loop through properties want alter in $proparr; prop=$proparr[$i]; arg=$propvalarr[$i]; if grep -fq $prop $file ; linenum=`sed -n "/${prop}/=" $file`; sed -i "${linenum} c${prop}=${arg}" $file; else echo $prop=$arg >> $file; fi; done;
i setting array variables incorrectly.
here right way it:
#properties alter array proparr = ('net.tcp.buffersize.default' 'net.tcp.buffersize.wifi' 'net.tcp.buffersize.umts' 'net.tcp.buffersize.gprs' 'net.tcp.buffersize.edge' 'wifi.supplicant_scan_interval' 'ro.home_app_adj' 'dalvik.vm.dexopt-flags' 'dalvik.vm.execution-mode' 'dalvik.vm.heapstartsize' 'dalvik.vm.heapgrowthlimit' 'dalvik.vm.heapsize' 'dalvik.vm.heaptargetutilization' 'dalvik.vm.heapminfree' 'dalvik.vm.heapmaxfree' 'debug.sf.hw'); #property values propvalarr = ('4096,87380,256960,4096,16384,256960' '4096,87380,256960,4096,16384,256960' '4096,87380,256960,4096,16384,256960' '4096,87380,256960,4096,16384,256960' '4096,87380,256960,4096,16384,256960' '300' '1' 'm=y,v=n,o=v,u=n' 'init:jit' '16m' '128m' '512m' '0.75' '12m' '16m' '1');
android bash shell sh
Comments
Post a Comment