I have a simple shell script which is as follows.
#!/usr/bin/env bash
wget -O glove.840B.300d.zip http://nlp.stanford.edu/data/glove.840B.300d.zip
When I run it using sh command, I get the following error.
--2017-06-29 20:35:41-- http://nlp.stanford.edu/data/glove.840B.300d.zip%0D
Resolving nlp.stanford.edu (nlp.stanford.edu)... 171.64.67.140
Connecting to nlp.stanford.edu (nlp.stanford.edu)|171.64.67.140|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://nlp.stanford.edu/data/glove.840B.300d.zip%0d [following]
--2017-06-29 20:35:41-- https://nlp.stanford.edu/data/glove.840B.300d.zip%0d
Connecting to nlp.stanford.edu (nlp.stanford.edu)|171.64.67.140|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2017-06-29 20:35:41 ERROR 404: Not Found.
But when I run the same wget
command (written in the shell script) from terminal, it works fine! What is the problem in my shell script? What I am missing?