Courseiva

EX200 · topic practice

Create simple shell scripts practice questions

Practise Red Hat Certified System Administrator EX200 Create simple shell scripts practice questions — original exam-style scenarios with answer choices, explanations, and analysis of common mistakes.

Courseiva uses original exam-style practice questions designed for learning and revision. The goal is to understand the concepts, recognise exam patterns, and improve through explanations — not memorise copied exam dumps.

Reviewed byJohnson Ajibi· MSc IT Security
20 questionsDomain: Create simple shell scripts

What the exam tests

What to know about Create simple shell scripts

Create simple shell scripts questions test whether you can apply the concept in context, not just recognise a definition.

How the topic appears in realistic exam-style scenarios.

Which detail in the question changes the correct answer.

How to eliminate plausible but wrong options.

How to connect the question back to the wider exam objective.

Watch out for

Common Create simple shell scripts exam traps

  • Answering from memory before reading the full scenario.
  • Missing a constraint such as cost, availability, security, scope or command context.
  • Choosing a broad answer when the question asks for the most specific fix.
  • Ignoring why the wrong options are tempting.

Practice set

Create simple shell scripts questions

20 questions · select your answer, then reveal the explanation

Which THREE of the following practices are recommended when creating simple shell scripts in a Red Hat Enterprise Linux environment to ensure reliability, security, and maintainability?

Refer to the exhibit. A junior admin runs this script as root, but it always prints 'httpd is running' even when httpd is stopped. What is the most likely cause?

Network Topology
if systemctl is-activequiet $SERVICERefer to the exhibit.```bash#!/bin/bash# Script: check_service.shSERVICE="httpd"thenecho "$SERVICE is running"elsesystemctl restart $SERVICEecho "$SERVICE was restarted"fi```

You are a system administrator for a medium-sized company running Red Hat Enterprise Linux 8 on all servers. The development team has created a shell script that is supposed to be run nightly via cron to synchronize configuration files from a master server to multiple web servers. The script is located at /opt/scripts/sync_configs.sh and is owned by root. It uses rsync over SSH with key-based authentication. The script works perfectly when run manually by root, but when it runs via cron, the synchronization fails with the error 'Host key verification failed.' The script does not explicitly specify any SSH options. The cron job is configured in /etc/crontab as: `0 2 * * * root /opt/scripts/sync_configs.sh`. The SSH keys are stored in /root/.ssh/id_rsa and the known_hosts file contains the correct host key for the master server. What is the most likely cause of the failure, and what is the best course of action to resolve it?

Which TWO of the following are true about creating simple shell scripts in Red Hat Enterprise Linux?

You are a system administrator for a small company. The development team has created a shell script named 'deploy.sh' that automates deployment of a web application. The script is located at /home/devops/deploy.sh. The team reports that when they run the script with './deploy.sh' from the /home/devops directory, it fails with a 'Permission denied' error. However, running 'bash deploy.sh' works fine. Additionally, the script's first line is '#!/bin/bash' and the file permissions are '-rw-rw-r--'. The team wants to be able to run the script directly without typing 'bash'. Which of the following actions should you take to resolve the issue?

Arrange the steps to configure a logical volume snapshot named 'snap_lv_data' of logical volume 'lv_data'.

Drag steps to the numbered slots on the right, or tap a step then tap a slot.

Steps
Order
1Step 1
2Step 2
3Step 3
4Step 4
5Step 5

Match each package management command to its action.

Drag a concept onto its matching description — or click a concept then click the description.

Concepts
Matches

Install a package with dependencies

Uninstall a package

Update all packages to latest versions

Show all installed packages

A junior admin writes a script that uses functions. They notice that a variable set inside a function is not available after the function call. What is the likely cause and best practice?

A sysadmin creates a script to rotate log files. The script uses 'find /var/log -type f -name "*.log" -mtime +30 -exec gzip {} \;' but some log files are not compressed. The script runs as root. What is the most likely reason some files remain uncompressed?

A script uses 'read' to get user input and then performs an action based on the input. However, when the script is piped (e.g., './script.sh | othercommand'), the read command does not wait for input and the script continues with empty variable. How can this be fixed?

Which THREE of the following are common practices to improve the reliability of shell scripts?

Which TWO of the following are correct statements about exit codes in shell scripts?

A user executes the script shown in the exhibit with './export_script.sh' and then runs 'echo $MY_VAR' in the same terminal. The output is empty. Why does this happen?

Exhibit

Refer to the exhibit.
```bash
#!/bin/bash
# Script to set environment variable
MY_VAR="hello"
export MY_VAR
```

A script contains: lines=$(wc -l /etc/passwd); echo $((lines+1)). The output is unexpected. What is the problem?

A script has a syntax error. Which command will help identify the line number of the error without executing the script?

Which shell built-in can be used to read user input during script execution?

A script needs to read every line from a file and execute a command on each line. Which code block is correct and handles whitespace correctly?

Which TWO methods correctly create a variable containing the number of regular files in the current directory (excluding . and ..)?

Which THREE of the following are valid and recommended practices when writing shell scripts for RHEL?

Refer to the exhibit. The script produces the error shown. What is the most likely cause?

Exhibit

Refer to the exhibit.

#!/bin/bash
if [ $var = "value" ]
then
  echo "Match"
fi

Error: [: =: unary operator expected

Free account

Track your progress over time

Create a free account to save your results and see which topics improve across sessions.

Focused Create simple shell scripts sessions

Start a Create simple shell scripts only practice session

Every question in these sessions is drawn from the Create simple shell scripts domain — nothing else.

Related practice questions

Related EX200 topic practice pages

Move into related areas when this topic feels solid.

Frequently asked questions

What does the EX200 exam test about Create simple shell scripts?
Create simple shell scripts questions test whether you can apply the concept in context, not just recognise a definition.
How should I use these practice questions?
Select your answer before revealing the explanation. Then read why each option is right or wrong — this active recall approach builds retention far faster than re-reading notes.
Can I practise just Create simple shell scripts questions in a focused session?
Yes — the session launcher on this page draws every question from the Create simple shell scripts domain. Use a 10-question session first to gauge your baseline, then move to 20 or 30 once the weak spots are clear.
Where can I practise other EX200 topics?
Use the topic links above to move to related areas, or go back to the EX200 question bank to see all topics.
Are these real exam questions or dumps?
These are original practice questions written to test the same concepts the EX200 exam covers. They are not copied from any real exam or dump site.