
Mastering Linux Shell Scripting

Quiz
•
Computers
•
12th Grade
•
Hard
Grit and Motivation
Used 2+ times
FREE Resource
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.
Create a free account and access millions of resources
Similar Resources on Wayground
14 questions
DOS commands

Quiz
•
12th Grade
20 questions
QUIZ AJIB INFORMATIKA 7

Quiz
•
10th Grade - University
20 questions
Python Basic 1

Quiz
•
12th Grade
20 questions
Python Basics Review (TSK)

Quiz
•
9th - 12th Grade
16 questions
Python basics

Quiz
•
9th - 12th Grade
15 questions
FILE MANAGEMENT

Quiz
•
KG - University
20 questions
CPA JYSS 2018 Prelims Paper 1

Quiz
•
7th Grade - Professio...
14 questions
Arduino

Quiz
•
12th Grade
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
10 questions
UPDATED FOREST Kindness 9-22

Lesson
•
9th - 12th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
20 questions
US Constitution Quiz

Quiz
•
11th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade