Given a file in a Github repository such as https://github.com/user/project-name/blob/master/filename
, and I wrote a shell script (or a function in a shell script) to download this file called filename
(https://raw.githubusercontent.com/user/project-name/master/filename
), if the file already exists in my local path, then I could just check the latest modification date of the file.
If the date is newer than the date which is already written into the file, I should just remove the old file and download it from GitHub repository directly, or else, I should do nothing.
How can I do it in shell script?