Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 在Bash中使用shutdown命令时出错_Linux_Bash - Fatal编程技术网

Linux 在Bash中使用shutdown命令时出错

Linux 在Bash中使用shutdown命令时出错,linux,bash,Linux,Bash,现在运行脚本 read -p 'Want to use the timer (y/n) ? ' jwb2 if [[ $jwb2 =~ ^[Yy]$ ]]; then echo -n "Now Days " date +"%A and hour %T" read -p 'How many hours [24hrs] :' jwb3 echo Process the command sudo bash -c "

现在运行脚本

read -p 'Want to use the timer (y/n) ? ' jwb2
    if [[ $jwb2 =~ ^[Yy]$ ]]; then
        echo -n "Now Days "
        date +"%A and hour %T"
        read -p 'How many hours [24hrs] :' jwb3
        echo Process the command
        sudo bash -c "Shutdown -h $jwb3"
    fi
bash:Shutdown:未找到命令


为什么会出现此错误?

使用
shutdown
而不是
shutdown

仍然保持相同的显示方式
whereis-b shutdown
使用
shutdown
命令的完整路径作为
/sbin/shutdown-h$jwb3
me@linux:$./main.sh
Want to use the timer (y/n) ? y
Now Days Thursday and hour 16:09:49
How many hours [24hrs] :18:00
Process the command