#!/bin/sh PROFILES="/usr/local/bin/profiles" test -f ${PROFILES} || exit 0 TEMPFILE=/tmp/${USER}-profile.tmp if (test -f ${TEMPFILE}) then read line < ${TEMPFILE} PROFILE=${line} else PROFILE=Dynamic fi i=0 flaga=0 while read line do i=`expr $i + 1` if (test "${line}" = "${PROFILE}") then flaga=$i fi done < ${PROFILES} if (test $flaga -eq $i) then flaga=1 else flaga=`expr $flaga + 1` fi j=0 while read line do j=`expr $j + 1` if (test $flaga -eq $j) then PROFILE=${line} fi done < ${PROFILES} CMD="dbus-send --print-reply --session --dest=org.kde.powerdevil /modules/powerdevil org.kde.PowerDevil.setProfile string:" ${CMD}"${PROFILE}" echo ${PROFILE} > ${TEMPFILE}