I am connecting to an external client using sftp. i gave the following command
#!/usr/bin/expect -f
spawn sftp username@hostname
expect "password: "
send "xxxxx"expect sftp>
...
...but the command was not working.
The Error is :
spawn: command not found
couldn't read file "password:": no such file or directory
send: command not found
couldn't read file "sftp>": no such file or directory
send: command not found
couldn't read file "sftp>": no such file or directory
send: command not found
Kindly help asap, with some other options.
I am taking what you posted literally: "I gave the following command". What you then detail is suitable for use as a script file, not to be typed in interactively. If you just typed the above lines at a command prompt you would get exactly the errors you detail. (Although I'm a little puzzled - if you were doing this interactively why use "expect"? Why not just type in the commands?) Perhaps you could clarify. Did you type those commands interactively or did you create a script file?
Edit: Actually, thinking further, that wouldn't work even as a script. "expect -f" should be followed by the name of a file containg the commands you want to run. Perhaps you need to read up more about "expect".
| « [Solved] Split one file into multi... | NEED HELP FAST Batch prog... » |