问题描述
我有这个脚本可以在电池电量超过 80% 时收到通知,但它不起作用
问题类似于:
/home/aerolito/battery-full-notification/batteryfull.sh: line 7: [: 0 100: integer expression expected
这里是脚本
#!/usr/bin/env bash
while true
do
export disPLAY=:0.0
battery_percent=$(acpi -b | grep -P -o '[0-9]+(?=%)')
if on_ac_power; then
if [ "$battery_percent" -gt 80 ]; then
notify-send -i "$PWD/battery-full-notification/batteryfullR.png" "Battery full." "Level: ${battery_percent}% "
# notify-send -i "$PWD/batteryfullR.png" "Battery full." "Level: ${battery_percent}% "
paplay /usr/share/sounds/other/rings.ogg
fi
fi
sleep 300 # (5 minutes)
done
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)