Hands-on Lab·Red Hat Certified System Administrator
Command Output in Shell Scripts
The last of the four scripting objectives, and the one that turns a script from a list of commands into something that reacts. Command substitution, arithmetic on captured values, branching on exit status and reading output into an array are all run here.
Shell Scripts Guide 65 of 67 Intermediate
- OSRHEL 10.0 (Coughlan)
- Kernel6.12.0-55.9.1.el10_0
- dnf4.20.0
- Flatpak1.16.0
- TimeAbout 13 min
- Reviewed23 August 2026
Written against the versions above. `$(command)` is preferred over backticks: it nests without escaping and is easier to read. Both work and the exam accepts either. Command substitution **strips trailing newlines**, which is usually what you want and occasionally is not.
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| RHCSA-A01 | 192.168.0.31 | RHEL 10.0 (Coughlan) | Practice node (graded) - spare /dev/sda | 2 Core | 4 GB | 50 GB + 15 GB |
Before you start
- A shell.
- The session writes and removes
~/scripts.
-
Capturing, counting and branching
-
Two syntaxes, and what gets stripped
-
All four objectives in one script