Is there any way to put the password typed by user into a file (either in Unix or in expect).
read -s -p "enter password" input
echo $input > file
Is the above code safe?
I want to use that file as an input for password in my expect script
Because I have tried this and I could see the password shown on the screen just for a sec with this expect code.
set timeout 30
stty -echo
send_user -- "Password for $username :"
expect_user -re "(.*)\n"
set timeout .000000001
set timeout 30
send_user "\n"
set timeout 30
set password $expect_out(1,string)
send -- "$password\r"