#!/bin/bash if [ -z "$*" ]; then cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor; exit; fi test="$(sudo sh -c "echo $@ >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor" 2>&1)" if [ "$test" != "" ]; then echo "$test" exit 1 fi sudo sh -c "for core in \$(seq 1 \"\$((\$(getconf _NPROCESSORS_ONLN) - 1))\"); do echo $@ >/sys/devices/system/cpu/cpu\$core/cpufreq/scaling_governor done"