Das Shell-Skript mit If-ELSE gibt den Befehl zurück, der bei der Ausführung der letzten Zeile keinen Fehler gefunden hatAndroid

Forum für diejenigen, die für Android programmieren
Anonymous
 Das Shell-Skript mit If-ELSE gibt den Befehl zurück, der bei der Ausführung der letzten Zeile keinen Fehler gefunden hat

Post by Anonymous »

Ich habe ein Shell -Skript, um die CPU -Frequenz auf allen Kernen auf Android -Geräten auf maximal aufzulegen. Der Inhalt ist: < /p>
#!/system/bin/sh
cpucores=`grep -c ^processor/proc/cpuinfo`
cpusint=`echo $((cpucores-1))`
littlefreq=`cat /sys/devices/system/cpu/cpu$cpusint/cpufreq/scaling_max_freq`
bigfreq=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq`
cpuhalf=$((cpucores/2))
cpuhalfint=`echo $((cpufalf-1))`
if [$bigfreq -ne $littlefreq];
then
for i in `seq 0 $cpuhalfint`; do
chmod 0644 /sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor
echo "performance" > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor
chmod 0644 /sys/devices/system/cpu/cpu$i/cpufreq/scaling_min_freq
echo $bigfreq > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_min_freq
done
for x in `seq $cpuhalfint $cpusint`; do
chmod 0644 /sys/devices/system/cpu/cpu$x/cpufreq/scaling_governor
echo "performance" > /sys/devices/system/cpu/cpu$x/cpufreq/scaling_governor
chmod 0644 /sys/devices/system/cpu/cpu$x/cpufreq/scaling_min_freq
echo $littlefreq > /sys/devices/system/cpu/cpu$x/cpufreq/scaling_min_freq
done
else
for i in `seq 0 $cpusint`; do
chmod 0644 /sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor
echo "performance" > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor
chmod 0644 /sys/devices/system/cpu/cpu$i/cpufreq/scaling_min_freq
echo $bigfreq > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_min_freq
done
fi
< /code>
Das Skript funktioniert einwandfrei, gibt jedoch dies zurück: < /p>
./setcpu.sh[28]: [1248000: not found
< /code>
(1248000 ist meine CPU -Frequenz, und setCpu.sh ist der Name der Shell -Skriptdatei) < /p>
, während es überhaupt nichts ausgeben sollte. Weiß jemand, warum das passiert?
Danke für die Antwort.

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post