I have a bash expect script like this (I am using it in Jamf):
spawn firmwarepasswd -setpasswd
expect {
"Enter password:" {
send "$oldpass
"
exp_continue
}
"Enter new password:" {
send "$newpass
"
exp_continue
}
"Re-enter new password:" {
send "$newpass
"
exp_continue
}
}
If the password fails, the script will not exit and jamf will keep trying to execute it. How can I get it to return 1 and exit if the password is wrong?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…