1/26
These flashcards cover the key vocabulary for Bash programming including loops (while, until, for), select commands, functions, arithmetic operations, array and string manipulation, signal handling with trap, and debugging techniques.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
while Loop
A control structure that executes statements as long as the provided condition holds true, formatted as: while [ expression ] do … done
−le
A Bash comparison operator representing 'less than or equal to'.
until Loop
A control structure that executes statements as long as the condition holds false, using the format: until [ expression ] do … done
−lt
A Bash comparison operator representing 'less than'.
for Loop
A loop used to iterate over a list of arguments or a series of 'words' within a string using the format: for varname in arg1 … argN do … done
bc
A precision calculator used to obtain accurate floating-point results in Bash, as standard arithmetic expansions return integer values only.
C-like for Loop
An alternative for structure in Bash formatted as: for (( expression1 ; expression2 ; expression3 )) do … done
select Command
A command that constructs a simple menu from a list, allowing the user to enter a sequence number corresponding to an argument.
PS3
The 'select sub-prompt' prompt statement used by the select command inside a shell script.
REPLY
A variable that stores the user's numeric input when using the select command.
break
A statement that terminates the execution of a loop and transfers control to the statement following the done keyword.
continue
A statement that skips the remaining statements in the current iteration of a loop and transfers control back to the loop's test or done statement.
Shell Function
A series of commands stored in memory and executed in the same shell that called it, rather than a subshell; it must be defined before it is referenced.
\$#
A parameter that reflects the number of positional parameters passed to a function.
$0
A parameter that contains the name of the script being executed, rather than the name of a specific function.
local
A keyword used inside a function to restrict the scope of a variable to that function, preventing it from being global.
${arrayname[∗]}
The syntax used to extract all elements from a Bash array.
${#arrayname[∗]}
The syntax used to determine the total number of elements currently stored in an array.
${#string}
The string manipulation operation that returns the length of a string.
${string:pos:len}
The operation used to extract a substring of length len from string starting at position pos.
Ctrl-C (^C)
A keyboard shortcut that sends an interrupt signal to stop a program from running or terminate bash.
Ctrl-D (^D)
A signal representing the end of input (EOF) which causes the shell to exit unless the ignoreeof option is set.
kill -l
The Linux command used to display a list of all supported signals.
trap
The command used to install a custom signal handler or reset a signal handler when followed only by a signal number.
-v option
A debugging option that prints each line of the script as it is read by the shell.
-x option
A debugging option that displays each command and its arguments as they are executed (trace mode).
set +xv
The command used to turn off the verbose (-v) and trace (-x) debugging options in a shell script.