-5
#!/bin/bash
# This Script is for getting Automatic HDF Files  
# Product MODIS MYD11A2 Data From web https://e4ftl01.cr.usgs.gov/  
# Change Login And Passwords User registred on Earthdata
# This example can download 4 Tiles MODIS like 
# h11v11 h11v12 h12v11 h12v12
# For me exclude xml files.
#
chmod 0600 ~/.netrc
touch ~/.netrc
echo "machine urs.earthdata.nasa.gov login XXX password XXXX" > ~/.netrc

touch ~/.urs_cookies


    for year in $(seq -w 2003 2018)
    do
        for mes in $(seq -w 01 12)
        do
            for dia in $(seq -w 1 31)
            do

    fecha=$year.$mes.$dia
    wget -q --load-cookies ~/.urs_cookies --save-cookies ~/.urs_cookies --keep-session-cookies --no-check-certificate --auth-no-challenge=on --reject "index.html*" http://e4ftl01.cr.usgs.gov/MOLA/MYD11A2.006/$fecha/ -O /dev/stdout | gawk 'BEGIN{FS="href="}{print $2}' |gawk  -v fecha=$fecha 'BEGIN{FS="\""}{print "wget -nc --load-cookies ~/.urs_cookies --save-cookies ~/.urs_cookies --keep-session-cookies --no-check-certificate --auth-no-challenge=on --reject \"index.html*\" http://e4ftl01.cr.usgs.gov/MOLA/MYD11A2.006/"fecha"/"$2}'|grep h11v11|grep -v jpg|grep -v xml |sh
    wget -q --load-cookies ~/.urs_cookies --save-cookies ~/.urs_cookies --keep-session-cookies --no-check-certificate --auth-no-challenge=on --reject "index.html*" http://e4ftl01.cr.usgs.gov/MOLA/MYD11A2.006/$fecha/ -O /dev/stdout | gawk 'BEGIN{FS="href="}{print $2}' |gawk  -v fecha=$fecha 'BEGIN{FS="\""}{print "wget -nc --load-cookies ~/.urs_cookies --save-cookies ~/.urs_cookies --keep-session-cookies --no-check-certificate --auth-no-challenge=on --reject \"index.html*\" http://e4ftl01.cr.usgs.gov/MOLA/MYD11A2.006/"fecha"/"$2}'|grep h11v12|grep -v jpg|grep -v xml |sh
    wget -q --load-cookies ~/.urs_cookies --save-cookies ~/.urs_cookies --keep-session-cookies --no-check-certificate --auth-no-challenge=on --reject "index.html*" http://e4ftl01.cr.usgs.gov/MOLA/MYD11A2.006/$fecha/ -O /dev/stdout | gawk 'BEGIN{FS="href="}{print $2}' |gawk  -v fecha=$fecha 'BEGIN{FS="\""}{print "wget -nc --load-cookies ~/.urs_cookies --save-cookies ~/.urs_cookies --keep-session-cookies --no-check-certificate --auth-no-challenge=on --reject \"index.html*\" http://e4ftl01.cr.usgs.gov/MOLA/MYD11A2.006/"fecha"/"$2}'|grep h12v11|grep -v jpg|grep -v xml |sh
    wget -q --load-cookies ~/.urs_cookies --save-cookies ~/.urs_cookies --keep-session-cookies --no-check-certificate --auth-no-challenge=on --reject "index.html*" http://e4ftl01.cr.usgs.gov/MOLA/MYD11A2.006/$fecha/ -O /dev/stdout | gawk 'BEGIN{FS="href="}{print $2}' |gawk  -v fecha=$fecha 'BEGIN{FS="\""}{print "wget -nc --load-cookies ~/.urs_cookies --save-cookies ~/.urs_cookies --keep-session-cookies --no-check-certificate --auth-no-challenge=on --reject \"index.html*\" http://e4ftl01.cr.usgs.gov/MOLA/MYD11A2.006/"fecha"/"$2}'|grep h12v12|grep -v jpg|grep -v xml |sh
            done
        done
    done

closed as off-topic by user2856, Vince, PolyGeo Aug 23 at 0:47

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "When seeking help to debug/write/improve code always provide the desired behavior, a specific problem/error and the shortest code (as formatted text, not pictures) needed to reproduce it in the question body. Providing a clear problem statement and a code attempt helps others to help you." – Vince, PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    This is an example of a "wall of code" post. They are often downvoted because no attempt has been made to describe the situation, the task, the intended approach, or to describe the problem. Please Edit the question to be a Question. – Vince Aug 22 at 23:46
  • 1
    This is not a question. Nevertheless, I have provided an answer. I've no idea if it is the answer to the question, as I don't know what the question is. – Son of a Beach Aug 23 at 0:20
1

In the shell:

cd /path/to/script/directory
vi script_file_name

In vi:

:%s/XXXX/your_password/
:%s/XXX/your_login_name/
:wq

In the shell:

./script_file_name
  • Yes Son Of the Beach!!! This Script is my contributions. Is not a Questions is a Solutions... Regards!! – Sigologo Aug 23 at 13:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.