RHCSA Shell Scripting and Automation Flashcards
6 cards from real RHCSA practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 6 RHCSA Shell Scripting and Automation flashcards as text
Which shebang line is used to indicate a Bash script on a RHEL system?
Answer: #!/bin/bash
The shebang `#!/bin/bash` explicitly invokes the Bash interpreter located at `/bin/bash` on RHEL systems.
What command is used to make a shell script executable?
Answer: chmod +x script.sh
The `chmod +x` command adds the execute permission bit to a file, allowing it to be run as a script.
In a Bash script, how do you store the output of the `date` command in a variable called `TODAY`?
Answer: TODAY=$(date)
Command substitution using `$(command)` captures the standard output of a command and assigns it to a variable.
Which loop structure is best suited for iterating over a list of filenames in a Bash script?
Answer: for loop
The `for` loop is ideal for iterating over a finite list of items such as filenames or strings in Bash.
What is the exit status of a Bash command that completes successfully?
Answer: 0
A successful command returns exit status `0`, while any non-zero value indicates an error or abnormal termination.
How do you reference the first argument passed to a shell script?
Answer: $1
`$1` holds the value of the first positional parameter passed to the script on the command line.
Written and edited by Nathan Beja, founder of Practice Test Geeks, with AI assistance. Exam facts are checked against the official sources linked below. 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
- redhat.com — Test delivery, retake policy, score release, renewal, score validity, exam information · verified Dec 2026