0
0
Bash Scriptingscripting~10 mins

File download automation in Bash Scripting - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete 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'
A-d
B-O
C-L
D-o
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.
2fill in blank
medium

Complete 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'
A--show-progress
B-q
C-b
D-O
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.
3fill in blank
hard

Fix 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'
A-c
B-b
C-q
D-i
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.
4fill in blank
hard

Fill 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'
A-s
B2
C5
D-L
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.
5fill in blank
hard

Fill 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'
A--retry-connrefused
B3
C30
D--silent
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.