Welcome, Guest. Please login or register.
Did you miss your activation email?

Author Topic: [DE] kleiner Cpu Freq indicator für die Konsole  (Read 4050 times)

Offline ralul

  • User
  • Posts: 1.814
[DE] kleiner Cpu Freq indicator für die Konsole
« on: 2011/06/16, 14:25:47 »
Nach einem Tastendruck stoppt der Output.
Code: [Select]
#!/bin/bash
# pause 2seconds as default, or take first parameter as pause
[ -n "$1" ] && a="$1" || a="2"

# initialize array s (show one single sign for frequency)
declare -a z=( '#'  '+'  '='  '-'  '_'  '.'  '!'  'too_much_freqencies!' )
declare -a f="$(head -n 1 /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies)"
declare -a s
j=0
for i in ${f[@]} ; do
  s[$i]=${z[$j]}
  j=$(($j + 1))
done

# one time in advance - for not to wait
for i in /sys/devices/system/cpu/cpu[012345678]/cpufreq/scaling_cur_freq ; do
    echo -n ${s[$(<$i)]}
done

# until key hit
until read -s -n 1 -t $a ; do
  for i in /sys/devices/system/cpu/cpu[012345678]/cpufreq/scaling_cur_freq ; do
    echo -n ${s[$(<$i)]}
  done
done
echo " "
experiencing siduction runs better than my gentoo makes me know I know nothing