#!/bin/sh set -eu case "${0%%*/}" in *_performance) governor=performance;; *_powersave) governor=powersave;; *) exit 1;; esac for f in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do sudo -- sh -c "echo $governor > '$f'" done