Simulate user input in bash script [closed]
You should find the ‘expect’ command will do what you need it to do. It’s widely available. See here for an example More examples here A very rough example: #!/usr/bin/expect set pass “mysecret” spawn /usr/bin/passwd expect “password: ” send “$pass” expect “password: ” send “$pass”