Bash Scripting - Loops, Functions, and Signal Handling

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/26

flashcard set

Earn XP

Description and Tags

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.

Last updated 6:17 PM on 6/23/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

27 Terms

1
New cards

while Loop

A control structure that executes statements as long as the provided condition holds true, formatted as: while [ expression ] do … done

2
New cards

le-le

A Bash comparison operator representing 'less than or equal to'.

3
New cards

until Loop

A control structure that executes statements as long as the condition holds false, using the format: until [ expression ] do … done

4
New cards

lt-lt

A Bash comparison operator representing 'less than'.

5
New cards

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

6
New cards

bc

A precision calculator used to obtain accurate floating-point results in Bash, as standard arithmetic expansions return integer values only.

7
New cards

C-like for Loop

An alternative for structure in Bash formatted as: for (( expression1 ; expression2 ; expression3 )) do … done

8
New cards

select Command

A command that constructs a simple menu from a list, allowing the user to enter a sequence number corresponding to an argument.

9
New cards

PS3PS3

The 'select sub-prompt' prompt statement used by the select command inside a shell script.

10
New cards

REPLYREPLY

A variable that stores the user's numeric input when using the select command.

11
New cards

break

A statement that terminates the execution of a loop and transfers control to the statement following the done keyword.

12
New cards

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.

13
New cards

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.

14
New cards

\$#

A parameter that reflects the number of positional parameters passed to a function.

15
New cards

$0\$0

A parameter that contains the name of the script being executed, rather than the name of a specific function.

16
New cards

local

A keyword used inside a function to restrict the scope of a variable to that function, preventing it from being global.

17
New cards

${arrayname[]}\$\{arrayname[*]\}

The syntax used to extract all elements from a Bash array.

18
New cards

${#arrayname[]}\$\{\#arrayname[*]\}

The syntax used to determine the total number of elements currently stored in an array.

19
New cards

${#string}\$\{\#string\}

The string manipulation operation that returns the length of a string.

20
New cards

${string:pos:len}\$\{string:pos:len\}

The operation used to extract a substring of length lenlen from stringstring starting at position pospos.

21
New cards

Ctrl-C (^C)

A keyboard shortcut that sends an interrupt signal to stop a program from running or terminate bash.

22
New cards

Ctrl-D (^D)

A signal representing the end of input (EOF) which causes the shell to exit unless the ignoreeof option is set.

23
New cards

kill -l

The Linux command used to display a list of all supported signals.

24
New cards

trap

The command used to install a custom signal handler or reset a signal handler when followed only by a signal number.

25
New cards

-v option

A debugging option that prints each line of the script as it is read by the shell.

26
New cards

-x option

A debugging option that displays each command and its arguments as they are executed (trace mode).

27
New cards

set +xv

The command used to turn off the verbose (-v) and trace (-x) debugging options in a shell script.