Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to download a file using curl.
Bash Scripting
curl https://example.com/file.txt [1] file.txt Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-O' saves the file with the remote name, not a custom name.
Using '-d' is for sending data, not downloading.
Using '-L' follows redirects but does not specify output file.
✗ Incorrect
The '-o' option in curl specifies the output filename for the downloaded file.
2fill in blank
mediumComplete the code to download a file and show progress bar with wget.
Bash Scripting
wget [1] https://example.com/file.zip Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-q' hides output, so no progress is shown.
Using '-b' runs wget in background, no progress shown.
Using '-O' specifies output file, not progress.
✗ Incorrect
The '--show-progress' option in wget shows a progress bar during download.
3fill in blank
hardFix the error in the script to download multiple files listed in urls.txt using wget.
Bash Scripting
while read url; do wget [1] "$url" done < urls.txt
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-i' expects a file input, but here URLs are read from a file already.
Using '-b' runs in background, not needed here.
Using '-q' suppresses output, not fixing errors.
✗ Incorrect
The '-c' option allows wget to continue downloads if interrupted, useful in loops.
4fill in blank
hardFill both blanks to create a script that downloads files from a list and logs output.
Bash Scripting
while read url; do curl [1] "$url" -o "$(basename "$url")" >> download.log 2>&1 sleep [2] done < urls.txt
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-L' follows redirects but does not silence output.
Using '2' seconds sleep might be too short for some servers.
Not using silent mode causes cluttered logs.
✗ Incorrect
Use '-s' for silent curl output and '5' seconds sleep between downloads to avoid overload.
5fill in blank
hardFill all three blanks to create a robust download script with retries and timeout.
Bash Scripting
curl [1] --retry [2] --max-time [3] -O https://example.com/data.csv
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '--silent' hides output but does not control retries or timeout.
Setting retries too high can cause long waits.
Timeout too low may abort downloads prematurely.
✗ Incorrect
Use '--retry-connrefused' to retry even if connection refused, retry 3 times, and timeout after 30 seconds.