Hands-on Lab·Red Hat Certified System Administrator
Shell Script Arguments
One objective, `$1` and `$2` by name. The parts worth practising are the argument count check that makes a script usable, and the difference between `"$@"` and `$*`, which is invisible until an argument contains a space.
Shell Scripts Guide 64 of 67 Beginner
- OSRHEL 10.0 (Coughlan)
- Kernel6.12.0-55.9.1.el10_0
- dnf4.20.0
- Flatpak1.16.0
- TimeAbout 11 min
- Reviewed23 August 2026
Written against the versions above. `"$@"` expands to one word per argument, preserving spaces inside each. `$*` joins them into a single string and then word-splits it. **`"$@"` with the quotes is almost always what you want**, and the quotes are not optional.
| 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.
-
The parameters
-
Refusing to run without them
-
`"$@"` and `$*`