You should find the ‘expect’ command will do what you need it to do. It’s widely available.
A very rough example:
#!/usr/bin/expect
set pass "mysecret"
spawn /usr/bin/passwd
expect "password: "
send "$pass"
expect "password: "
send "$pass"
You should find the ‘expect’ command will do what you need it to do. It’s widely available.
A very rough example:
#!/usr/bin/expect
set pass "mysecret"
spawn /usr/bin/passwd
expect "password: "
send "$pass"
expect "password: "
send "$pass"