Ubuntu免密码输入关机脚本

备注:命令很简单,重点在于不需要输入密码。可以结合自定义桌面图标,一键执行脚本。


#!/bin/bash
PASSWORD=
echo $PASSWORD  | sudo -S shutdown -h $1


man sudo

-S          The -S (stdin) option causes sudo to read the password from
            the standard input instead of the terminal device.  The pass‐
            word must be followed by a newline character.


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章