20+ practice questions focused on Create simple shell scripts — one of the most tested topics on the Red Hat Certified System Administrator EX200 exam. Each question includes a detailed explanation so you learn why the right answer is correct.
Start Create simple shell scripts PracticeA system administrator needs to create a shell script that checks if the user 'jdoe' exists in the system and, if not, creates the user with a home directory. The script should also verify that the creation was successful. Which of the following script snippets correctly implements this logic?
Explanation: It uses `id` to check for the user's existence (redirecting output to /dev/null to suppress messages), then uses `useradd -m` to create the user with a home directory. The `&&` and `||` operators ensure that success or failure of the creation is explicitly reported, fulfilling the requirement to verify successful creation.
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?
Explanation: When a command is used as a condition inside `[ ]`, the `test` builtin evaluates the exit status of the command inside the brackets, not the command itself. In this script, `[ systemctl is-active httpd ]` always returns true (exit code 0) because `[` treats the string "systemctl" as a non-empty string, which is always true. The correct syntax is to use the command directly as the condition: `if systemctl is-active httpd; then`.
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?
Explanation: D is correct because cron runs in a minimal environment that does not automatically load the SSH agent or add keys to it. When the script runs manually as root, the SSH agent is typically running and the key is loaded, but cron does not have access to the agent's socket. The error 'Host key verification failed' is misleading; the actual issue is that SSH cannot authenticate because the private key is not available to the agent, not that the host key is unknown. Adding `ssh -i /root/.ssh/id_rsa` explicitly specifies the key file, bypassing the need for an agent, or using `ssh-add` in the script loads the key into an agent for the cron session.
Match each package management command to its action.
Explanation: In RHEL 8/9, DNF is the default package manager. 'dnf install' installs packages with dependencies, 'dnf remove' uninstalls, 'rpm -ivh' installs local RPMs without dependency resolution. 'dnf update' updates all packages, and 'dnf search' finds packages by keyword. Common confusions arise between install/update and remove/search.
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?
Explanation: The variable is unavailable after the function call because it was declared with the 'local' keyword. To make it global, you should either remove the 'local' declaration or explicitly use 'declare -g'. There is no 'global' keyword in bash. Option A's cause is correct but its remedy is wrong; Option D has the correct remedy but incorrectly claims variables are local by default. Therefore, none of the given options is entirely correct.
+15 more Create simple shell scripts questions available
Practice all Create simple shell scripts questions1. Baseline your knowledge
Start with 10 questions to gauge your current understanding of Create simple shell scripts. This tells you whether you need a concept refresher or just practice.
2. Review every explanation
For each question — right or wrong — read the full explanation. Understanding why an answer is correct is more valuable than knowing the answer itself.
3. Focus on exam traps
Create simple shell scripts questions on the EX200 frequently use trap wording. Look for subtle differences in answers that test your precision, not just general knowledge.
4. Reach 80% consistently
Do repeated sessions until you score 80%+ three times in a row. Then move to mixed-mode practice to test cross-topic recall under realistic conditions.
The exact number varies per candidate. Create simple shell scripts is tested as part of the Red Hat Certified System Administrator EX200 blueprint. Practicing with targeted Create simple shell scripts questions ensures you can handle any format or difficulty that appears.
Yes. Courseiva provides free EX200 practice questions across all exam topics and domains. The platform includes topic-based practice, mock exams, missed-question review, bookmarked questions, and readiness tracking — no account required.
Difficulty is subjective, but Create simple shell scripts is a high-priority exam concept tested in multiple ways — direct recall, scenario analysis, and command-output interpretation. Consistent practice is the best way to build confidence.
Launch a full Create simple shell scripts practice session with instant scoring and detailed explanations.
Start Create simple shell scripts Practice →