passwords in shell scripts
hello!
i'm trying to write a script that will run a bunch of tests for me by transferring files using SCP. I would like to write a script that will SCP, then enter my password and repeat. How do i write a code that wil wait for a prompt and then enter a password? Thanks a lot! |
Edit: sorry, that puts it in automatically, and you want to put it in manually.
Well, now I don't know if this is what you have in mind or not. :( Here's part of an ftp script using expect. #!/usr/bin/expect -f spawn ftp -i 192.168.0.1 expect "Name" send "fred\r" expect "Passsword:" send "mypassword\r" |
thanks "homey" haha...
i'll try it out... is "expect" a command you can use for any program when waiting for a prompt?..i guess so? |
Re: passwords in shell scripts
Quote:
|
expect is the answer. If u havent done this b4, then better experiment with auto-expect which generates an expect script based on ur terminal activity.
1) run auto-expect. 2) do some activity. (ex: telnet to a machine and login and do an ls or somerthing) 3) exit (exits from auto-expect) 4) ls -ltr, last file is ur except script. run it |
All times are GMT -5. The time now is 11:41 PM. |