Shell Scripting and Automation Flashcards
7 cards from real LFCS Certification practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 7 Shell Scripting and Automation flashcards as text
What is the purpose of the shebang line (e.g., #!/bin/bash) at the top of a shell script?
Answer: It specifies the interpreter to use when executing the script
The shebang line tells the operating system which interpreter to use to execute the script when it is run directly.
Which command makes a shell script executable for the file owner, group, and others?
Answer: chmod +x script.sh
chmod +x adds the execute permission bit for owner, group, and others, making the script runnable.
What is the correct bash syntax to check if the integer variable $NUM equals 10?
Answer: if [ $NUM -eq 10 ]
The -eq operator is the correct arithmetic comparison operator for integers inside single bracket [ ] test expressions in bash.
Which special variable holds the exit status of the most recently executed command?
Answer: $?
$? stores the exit code of the last foreground command; 0 means success and any non-zero value indicates failure.
What is the correct way to assign the string 'admin' to the variable USERNAME in bash?
Answer: USERNAME='admin'
In bash, variable assignment uses no spaces around the = sign; spaces would cause bash to interpret it as a command.
What does the built-in `read` command do when used in a bash script?
Answer: Reads a line of input from stdin and stores it in a variable
The read command pauses script execution, waits for user input from stdin, and assigns the input to the specified variable.
Which bash loop construct iterates over each word in a space-separated list?
Answer: for item in list; do ... done
The for...in loop is the standard bash construct for iterating over a list of words, files, or output items.
How this page was made: written with AI tools and published by Nathan Beja, founder of Practice Test Geeks, who is responsible for its content. Exam facts are checked against the official sources listed below. Not reviewed by a subject-matter expert. Editorial policy
Sources & references
Exam facts on this page (fees, format, dates, passing scores) are checked against these official sources; the date is our last check. Editorial policy
- docs.linuxfoundation.org — Renewal, score release, exam format, passing score · verified Oct 2026
- training.linuxfoundation.org — Test delivery, eligibility, fees, registration deadline, time limit, score validity · verified Oct 2026