Tony H Tony H - 4 months ago 9x
Linux Question

What's a .sh file?

So I am not experienced in dealing with a plethora of file types, and I haven't been able to find much info on exactly what

files are. Here's what I'm trying to do:

I'm trying to download map data sets which are arranged in tiles that can be downloaded individually:

In order to download a range of tiles at once, they say to download their script, which eventually leads to

So, what exactly am I supposed to do with this code? The website doesn't provide further instructions, assuming users know what to do with it. I'm guessing you're supposed to paste the code in to some other unmentioned application for a browser (using Chrome or Firefox in this case)? It almost looks like something that could be pasted in to Firefox/Greasemonkey, but not quite. Just by a quick Google on the file type I haven't been able to get heads or tails on it.

I'm sure there's a simple explanation on what to do with these files out there, but it seems to be buried in plenty of posts where people are already assuming you know what to do with these files. Anyone willing to just simply say what needs to be done from square one after getting to the page with the code to actually implementing it? Thanks.


If you open your second link in a browser you'll see the source code:

# Script to download individual .nc files from the ORNL
# Daymet server at:


# For ranges use {start..end}
# for individul vaules, use: 1 2 3 4 
for year in {2002..2003}
   for tile in {1159..1160}
        do wget --limit-rate=3m${year}/${tile}_${year}/ -O ${tile}_${year}
        # An example using curl instead of wget
    #do curl --limit-rate 3M -o ${tile}_${year}${year}/${tile}_${year}/

So it's a bash script. Got Linux?

In any case, the script is nothing but a series of HTTP retrievals. Both wget and curl are available for most operating systems and almost all language have HTTP libraries so it's fairly trivial to rewrite in any other technology.