โ† All RHCSA Flashcard Decks

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
  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

  6. 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.