I am a greenhand in bash so please be patient with me. Thank you.
I am writing a bash script. There are three arguments: server, login id, and password. I want to copy all of the files in the id's home directory on the server with .c extension as well as encryption executable: encryptor to my current directory.
I tried to using scp and expect, but I have other code that need to run under #!/bin/bash, so that using expect won't work. Please suggest how could I implement this. Thank you very much!!
Difference from scp or sftp copy multiple files with single command:
- The id and password are command line argument when run the script so that I do not need to type in password after the script starts. For example, it works as "./example.sh server id password".
- I don't know the structure of the home directory on the remote server. Is there any way to select certain file and copy them to local using command in one bash script? will grep work? How to combine it with scp?