本文介绍了什么是.sh文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我在处理过多类型的文件方面没有经验,而且我还无法找到有关.sh文件确切信息的信息.这是我想要做的:

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 .sh files are. Here's what I'm trying to do:

我正在尝试下载以可单独下载的图块形式排列的地图数据集: http://daymet.ornl.gov /gridded

I'm trying to download map data sets which are arranged in tiles that can be downloaded individually: http://daymet.ornl.gov/gridded

为了立即下载一系列图块,他们说要下载其脚本,最终导致出现daymet-nc-retrieval.sh:

In order to download a range of tiles at once, they say to download their script, which eventually leads to daymet-nc-retrieval.sh: https://github.com/daymet/scripts/blob/master/Bash/daymet-nc-retrieval.sh

那么,我应该如何使用此代码?如果用户知道该怎么做,该网站将不提供进一步的说明.我猜您应该将代码粘贴到其他未提及的浏览器应用程序中(在这种情况下使用Chrome或Firefox)?看起来几乎可以粘贴到Firefox/Greasemonkey中,但并非完全如此.仅仅通过一个快速的Google来查看文件类型,我就无法对其进行正面或反面的分析.

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:

#!/bin/bash
# Script to download individual .nc files from the ORNL
# Daymet server at: http://daymet.ornl.gov

[...]

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

这是一个bash脚本.有Linux吗?

So it's a bash script. Got Linux?

无论如何,该脚本不过是一系列HTTP检索. wget和curl都可用于大多数操作系统,并且几乎所有语言都具有HTTP库,因此以任何其他技术进行重写都是相当简单的. bash本身也有一些Windows端口(git包含一个).最后但并非最不重要的一点是,Windows 10现在具有对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. There're also some Windows ports of bash itself (git includes one). Last but not least, Windows 10 now has native support for Linux binaries.

这篇关于什么是.sh文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 10:26
查看更多