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.


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