LearnRHCSA (EX200)Shell Scripts

Mission Control: Operation Toolsmith

bash - a hands-on Linux lab on a real virtual machine.

The RHCSA shell-scripts capstone mission on a real RHEL 10 machine. Write the classic exam script ~/bin/inspect to an exact spec, graded by running it. Mission mode.

You have finished the Shell Scripts module. Now you write one real tool on a real RHEL 10 machine, the way the exam works: you are handed a specification, and any script that behaves exactly as specified scores. The grader does not read your code. It RUNS your script with a set of inputs and checks what comes out.

One script, five requirements. You will build ~/bin/inspect from an empty file into a working tool: it guards the no-argument case, reports a file's line count, flags a missing path, and handles a whole list of arguments. This is the classic RHCSA script task.

This is mission mode. The specification is exact, but the code is yours. Progress checks itself by running your script; a signal is one click away if you get stuck.

One quick rep before the machine boots. A script counts how many arguments it was given with the special parameter that holds the argument count. Set three positional parameters and print the count.

prompt: student@servera:~$ answer: set -- a b c; echo "count is $#" output: count is 3 hint: The special parameter that holds the number of positional arguments is dollar-hash. Set three with set -- a b c, then echo it: echo "count is $#"

That argument count is the first thing your tool checks: no arguments means print the usage line and stop. The mission builds the rest of the tool one requirement at a time.

Boot the machine below and take the console. You will write ~/bin/inspect to a five-part specification. Edit the file, and the grader re-runs it against its test inputs automatically. Sample files are waiting in ~/work.

Practice Mission Control: Operation Toolsmith in a real Linux terminal at The Linux Camp. Progress is verified automatically as you type commands on the machine.