Hello, first of all let me state that I am not a systems administrator, I am just a humble geophysicist trying to retrieve some data from a server in an automated way.
I wrote an Expect script to do this:
set year [lindex $argv 0]
set jday [lindex $argv 1]
spawn scp username@server:/somepath/$year/$jday/* ./.
As you can see the data are in a directory structure that includes the year and the julian day.
Now, I know that it's better to do an RSA authentication or whatever it is and I shouldn't put the password in the script... I don't think the people who are giving me access to their data will let me do the RSA thing. So, let's assume that I have to use expect.
OK, the previous script works (only if I put that interact at the end, I have no idea why, if I don't put interact there then it gets to where the server is asking for the password and then returns to the prompt). The problem is that I don't want to sit there forever waiting for the data to download and then call the Expect script again with the next year jday combination. So I wrote a neat little bash script like so:
while read year jday
myscript.exp $year $jday
where dates.file is something like:
you get the idea.
That does not work. It shows the server asking for the password and then I'm back at the command prompt.
Please help. I hope I do not anger you with my ignorance, I tried really hard to find an answer in other similar threads before breaking down and starting a new thread. TIA