El shell de Linux espera maneja la interacción passwd

Los ejemplos son los siguientes:

#!/usr/bin/expect

set username [lindex $argv 0]
set userpass [lindex $argv 1]

# spawn the htpasswd command process
spawn passwd $username

# Automate the 'New password' Procedure
expect "New password:"
send "$userpass\r"

expect "Retype*"
send "$userpass\r"
expect eof

chmod +x scriptname
./scriptname username password

 

 

Supongo que te gusta

Origin blog.csdn.net/whatday/article/details/113860519
Recomendado
Clasificación