Why is the if-compression not comparing the value?
idle_time=exec sudo -u home xprintidle
if [ "$idle_time" -ge 6000 ]
then
echo "hi"
fi
it is not working like that
First of all, I changed to line which you use to execute xprintidle as a different user. After that I adjusted the if clause, since there was an error as well.
#!/bin/bash
# actually assign the variable
idle_time=$(idle_time=exec sudo -u home xprintidle)
# adapted if clause to actually match (see https://stackoverflow.com/questions/18668556/comparing-numbers-in-bash)
if [ "$idle_time" -gt "6000" ]; then
echo "hi"
fi