代码: 全选
#!/bin/bash
#get hour
hour=$(date +%H)
#if expression
if [ $hour -ge 8 ]&&[ $hour -lt 16 ];
then
shutdown -h 16:00; #Shutdown when 16:00 comes
else
halt; #Shutdown now
fi
然后打开终端 输入sudo nautilus
将该文件复制到usr/local/bin/文件夹内 并设置所有者和群组都为root 访问为读写
为什么却失效??