
Mastering Linux Shell Scripting
Authored by Joe Cusack
Computers
12th Grade
Used 3+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
17 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which command is used to list all files and directories in the current directory in Linux?
`ls`
`cd`
`pwd`
`rm`
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
In a shell script, how do you assign the value "Hello" to a variable named `greeting`?
`greeting = Hello`
`greeting: Hello`
`greeting="Hello"`
`greeting <- Hello`
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of the `if` statement in a shell script?
To repeat a block of code multiple times
To execute a block of code based on a condition
To define a function
To redirect input and output
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which command is used to redirect the output of a command to a file, overwriting the file if it exists?
`command > file`
`command >> file`
`command < file`
`command | file`
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the significance of the `$?` variable in shell scripting?
It stores the last executed command.
It stores the exit status of the last executed command.
It stores the current process ID.
It stores the number of arguments passed to the script.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How would you use a `for` loop in a shell script to iterate over a list of files?
`for file in ls; do echo $file; done`
`for file in ls; echo $file; done`
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Explain how you would handle errors in a shell script using `trap`.
Use `trap` to execute a command when a signal is received.
Use `trap` to ignore all errors in the script.
Use `trap` to log errors to a file.
Use `trap` to automatically retry failed commands.
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
17 questions
Kiến thức về trang tính
Quiz
•
7th Grade - University
15 questions
MVC-PHP
Quiz
•
12th Grade
15 questions
Cyber Security KS4
Quiz
•
8th - 12th Grade
15 questions
Linux-2 Quiz 2 -- LAMP
Quiz
•
1st - 12th Grade
12 questions
Windows 10 Installation
Quiz
•
11th - 12th Grade
12 questions
Microsoft Office Word
Quiz
•
4th Grade - University
15 questions
Empowerment Technologies
Quiz
•
KG - 12th Grade
15 questions
Soal Pra UKK 2024 - Paket 2
Quiz
•
12th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade