Help downloading Sentinel-2 data using wget on Linux

I am trying to download Sentinel-2 data from Linux with wget command. I have a list of many UUIDs (one example is shown) and am developing a script to download many tiles. I am following instructions that I found here: https://scihub.copernicus.eu/twiki/do/view/SciHubUserGuide/BatchScripting?redirectedfrom=SciHubUserGuide.8BatchScripting
I am using this syntax, (with my username and password in place of XXs)

wget --content-disposition --continue --user={XX} --password={XX}“https://scihub.copernicus.eu/dhus/odata/v1/Products(‘e05be5b0-eab7-4b61-8089-68ed5bcaf6df’)/$value

I get an error saying “value: Undefined variable.”

Does anyone know my mistake? I have tired various combinations of forward/back slashes before the $value. What is the logic of $value? Should i set that independently prior to executing wget? If i omit $value it complains that there is no url.

Any help would be much appreciated
Thank you
Lynsey Parker

Do you need to escape the ‘$’ character by ‘’?

If you read on in the instructions you will see that when using a “Unix Shell” the URL needs to have $value (here, “Unix” refers to a variety of operating systems including macOS and linux. For linux, the terminal typically uses the bash shell, which is one (of many) Unix Shell programs).

NOTE: Depending on the programming language used for scripting, the dollar ($) character might be interpreted as a wildcard character and not as a string value. The examples in this page are in Unix Shell and the backslash (\) needs to be used as escape character for the dollar ($) character.

Users new to the linux command line find it helpful to dedicate some time to learning linux command-line basics. There are many good resources, including youtube videos (search for site:youtube.com linux shell). A good place to start is Linux Command.

Thank you. I was using csh and getting an error with the $value, but i switched to bash and it worked. Thank you!

In this case, csh is actually more helpful than bash, but because bash is the default for the terminal in most linux distros, most online recipes assume bash:

 % bash -c 'echo a\$a a$a'
a$a a
% csh -c 'echo a\$a a$a'
a: Undefined variable.

For the download example, without the backslash (\), bash would run wget with an incomplete URL, while csh would not run wget at all.