0
0
Bash Scriptingscripting~10 mins

Appending to files (>>) 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 append the text 'Hello' to the file named output.txt.

Bash Scripting
echo "Hello" [1] output.txt
Drag options to blanks, or click blank then click option'
A<
B>
C>>
D|
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' which overwrites the file instead of appending.
Using '<' which is for input redirection, not output.
Using '|' which pipes output to another command.
2fill in blank
medium

Complete the code to append the output of the command 'date' to the file log.txt.

Bash Scripting
date [1] log.txt
Drag options to blanks, or click blank then click option'
A|
B>>
C<
D>
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' which overwrites the file.
Using '<' which is for input redirection.
Using '|' which sends output to another command.
3fill in blank
hard

Fix the error in the code to append the string 'Done' to the file results.txt.

Bash Scripting
echo Done [1] results.txt
Drag options to blanks, or click blank then click option'
A>>
B<
C>
D|
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' which overwrites the file.
Using '<' which is for input redirection.
Using '|' which pipes output to another command.
4fill in blank
hard

Fill both blanks to append the output of 'ls -l' to the file directory_list.txt.

Bash Scripting
[1] [2] directory_list.txt
Drag options to blanks, or click blank then click option'
Als -l
B>
C>>
Dcat
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' which overwrites the file.
Using 'cat' instead of the listing command.
Swapping the order of command and operator.
5fill in blank
hard

Fill all three blanks to append the word count of file.txt to counts.log.

Bash Scripting
[1] [2] [3] counts.log
Drag options to blanks, or click blank then click option'
Awc -w
B>>
Cfile.txt
D>
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' which overwrites the file.
Swapping the file name and operator positions.
Using wrong command instead of 'wc -w'.