Simplify this shell script
Hi Friends
I have written the below mentioned shell script to basically download files from the url mentioned in the file ur.txt and after completion of downloading the entire file move it to a specified directory. I would like to know whether there is any shorter way to do it instead of the long about method I have followed in the Script. One more problem which I am facing is that when I run this script through a ssh session using putty and I close the session the current file which is being downloaded get downloaded completely but after that no other files get downloaded. Can you please help me out. Code:
i=0 Vinayakm |
To avoid killing the session, use screen. It will allow you do disconnect and reconnect to a session at will as well as a few other nifty things.
As for the script, you could start by putting meaningful variables ;) |
Well, you could add the following to the wget command to eliminate the mv -v statement
Code:
--directory-prefix=<DIRECTORY_TO_STORE_TARBALLS> Code:
-i ../ur.txt And I agree with eco, your variables are meaningless. |
Hi Friends
Thanks for the replies. @eco suggestion taken regarding variables. The reason why I am parsing the url from a file is that once a file is downloaded completely from a url specified in the file then the url is removed. So at any point of time I will always have an updated list of what is remaining to be downloaded. The reason why i am not using directory-prefix is that sometimes i terminate the download midway so the download is not complete and whatever file was downloaded partially will not work. What functionality I wanted was that once a file is completely downloaded then the file should be moved to some other directory from where I can copy it to another machine. What i want to shorten in this script is that for extracting the filename alone i have to use a for loop instead of that is there any other easier way to do it Thanks and Regards Vinayakm |
You could use the --timestamp option with wget to only download files in your list if they are newer on the server. The --continue option will continue the download of files that are interrupted. Using those options, you could do something like this
Code:
#!/bin/sh Code:
#!/bin/sh |
Hi Friends
Thanks a lot for the help Thanks and Regards Vinayakm |
All times are GMT -5. The time now is 05:21 AM. |