執行該腳本需要用到expect,所有需要安裝expect工具(yum -y install expect)
#!/usr/bin/expect
set timeout 2
spawn su
expect "Password:"
exec sleep 1
send "實際的root密碼\r"
expect "#"
interact
執行該腳本需要用到expect,所有需要安裝expect工具(yum -y install expect)
#!/usr/bin/expect
set timeout 2
spawn su
expect "Password:"
exec sleep 1
send "實際的root密碼\r"
expect "#"
interact
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。