Recall & Review
beginner
What does File I/O stand for in scripting?
File I/O stands for File Input/Output. It means reading data from files (input) and writing data to files (output).
Click to reveal answer
beginner
Why is file I/O important in bash scripting?
File I/O lets scripts save data, read settings, and share information with other programs or users. It makes scripts useful and flexible.
Click to reveal answer
beginner
Give an example of a simple bash command to read a file.
The command
cat filename.txt reads and shows the content of filename.txt on the screen.Click to reveal answer
beginner
How can a bash script write output to a file?
Use the > symbol to redirect output. For example,
echo "Hello" > file.txt writes "Hello" into file.txt.Click to reveal answer
beginner
What real-life task can file I/O help automate in scripting?
File I/O can help automate tasks like saving logs, processing data files, or backing up important information automatically.
Click to reveal answer
What symbol is used in bash to write output to a file?
✗ Incorrect
The > symbol redirects output to a file, creating or overwriting it.
Which command reads and displays the content of a file in bash?
✗ Incorrect
The cat command reads and shows the content of a file.
Why do scripts use file I/O?
✗ Incorrect
File I/O allows scripts to read from and write to files, which is essential for many tasks.
What happens if you use > to write to a file that already exists?
✗ Incorrect
Using > overwrites the existing file with new content.
Which of these is NOT a use of file I/O in scripting?
✗ Incorrect
Changing keyboard layout is not related to file input/output.
Explain why file input/output is essential in bash scripting and give two examples of its use.
Think about how scripts get information and save results.
You got /5 concepts.
Describe how you would use bash commands to read from a file and write output to another file.
Focus on simple commands and redirection symbols.
You got /4 concepts.