#!/bin/bash set -e -E RADEON_DUMP=../radeon_dump ATICONFIG=aticonfig LAST=1 $ATICONFIG --set-powerstate=$LAST || true foo() { sleep 0.1 sudo $RADEON_DUMP > before.$LAST-$1.$RUN $ATICONFIG --set-powerstate=$1 || { echo ERROR: aticonfig returned $? !; exit 1; } sleep 0.1 sudo $RADEON_DUMP > after.$LAST-$1.$RUN if diff -q before.$LAST-$1.$RUN after.$LAST-$1.RUN > /dev/null; then echo WARNING: no change in {before,after}$LAST-$1.$RUN fi LAST=$1 } for (( RUN=1; RUN<10; ++RUN )); do foo 2 foo 3 foo 2 foo 1 done echo Success.