1/73
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
What is Shell Scripting?
Automating command execution using a script instead of typing commands one by one.
What is a Shell?
A command-line interpreter that acts as an interface between the user and the kernel.
What does CLI stand for?
Command-Line Interface.
What does Bash stand for?
Bourne Again Shell.
When was Bash first released?
1989.
What is a Bash script?
A text file (.sh) containing commands executed from top to bottom.
What file extension is commonly used for Bash scripts?
.sh
Name three text editors used to create scripts.
vim, gedit, emacs.
Are Linux filenames case-sensitive?
Yes.
Are john.txt, John.txt, and JOHN.txt the same file?
No, they are different files.
Which characters should be avoided in filenames?
, <, |, :, &
What does #!/bin/sh do?
Starts the shell script.
What symbol is used for comments in Bash?
#
What command displays text on the screen?
echo
What are variables used for?
To store and reuse data in a script.
What is a Local Variable?
A variable available only in the current shell instance.
What is a Shell Variable?
A special variable set by the shell for its operation.
What is an Environment Variable?
A variable available to child processes of the shell.
Which symbol is used for variable assignment?
=
How do you display a variable's value?
Using $ before the variable name.
What shell variable shows the Bash version?
$BASH_VERSION
What does $0 represent?
The filename of the current script.
What does $1 represent?
The first argument passed to the script.
What does $2 represent?
The second argument passed to the script.
What does $n represent?
The nth argument passed to the script.
What does $# represent?
The number of arguments supplied to a script.
What does $* represent?
All arguments as one double-quoted string.
What does $@ represent?
All arguments individually double-quoted.
What does $? represent?
The exit status of the last command executed.
What does $$ represent?
The process ID of the current shell.
What does $! represent?
The process ID of the last background command.
What command is used to get user input?
read
Which arithmetic operator performs addition?
+
Which arithmetic operator performs subtraction?
-
Which arithmetic operator performs multiplication?
*
Which arithmetic operator performs division?
/
Which arithmetic operator returns the remainder?
%
Which operator assigns a value to a variable?
=
Which operator checks equality?
==
Which operator checks inequality?
!=
What Bash command performs arithmetic operations?
let
What is the syntax for let?
let
What does -eq mean?
Equal to.
What does -ne mean?
Not equal to.
What does -gt mean?
Greater than.
What does -lt mean?
Less than.
What does -ge mean?
Greater than or equal to.
What does -le mean?
Less than or equal to.
Which brackets are used in conditional expressions?
[ ]
Why are spaces required inside [ ]?
Because Bash syntax requires spaces around expressions.
Which statement is used for decision-making in Bash?
if statement.
What keyword starts an if statement?
if
What keyword follows the condition in an if statement?
then
What keyword is used for the alternative condition?
else
What keyword ends an if statement?
fi
What is the purpose of a case statement?
To replace multiple if-then-else statements.
Which keyword starts a case statement?
case
Which keyword ends a case statement?
esac
What symbol creates a case option?
)
What symbol ends a case condition?
;;
What symbol represents the default option in a case statement?
*)
What is a loop?
A structure that repeats commands until a condition is met.
Which loop is used when iterating through a list of items?
for loop.
What are the reserved words for a for loop?
for, in, do, done.
Which loop runs while a condition is true?
while loop.
What are the reserved words for a while loop?
while, do, done.
Which loop runs until a condition becomes true?
until loop.
What are the reserved words for an until loop?
until, do, done.
What is the main purpose of shell scripting?
Automation of tasks and command execution.
What command outputs both text and variable values?
echo
What is the first line usually found in a shell script?
What is the default option in a case statement used for?
When no other cases match.
What happens when a while loop condition becomes false?
The loop stops executing.
What happens when an until loop condition becomes true?
The loop stops executing.