#!/usr/bin/env bash set -euo pipefail set -x case "${1}" in get) head -c1 /sys/firmware/acpi/platform_profile | tr '[:lower:]' '[:upper:]' ;; toggle) current="$(cat /sys/firmware/acpi/platform_profile)" choices="$(cat /sys/firmware/acpi/platform_profile_choices)" next="$(echo "${choices} ${choices}" | tr \ \\n | grep -A1 "${current}" | tail -n+2 | head -n1)" echo "${next}" | sudo tee /sys/firmware/acpi/platform_profile esac