A Script with Arguments and Exit Codes
Every good command-line tool tells you how to use it when you call it wrong. Write one.
Create the executable script /home/student/bin/greet.sh that behaves exactly like this:
| Call | Prints to stdout | Prints to stderr | Exit code |
|---|---|---|---|
greet.sh Sara | Hello, Sara! | nothing | 0 |
greet.sh "Mary Ann" | Hello, Mary Ann! | nothing | 0 |
greet.sh | nothing | usage: greet.sh NAME | 2 |
greet.sh a b | nothing | usage: greet.sh NAME | 2 |
The grader runs the script with other names too.
About this machine
Ubuntu 24.04 with no internet access. You are student with passwordless sudo. The grader checks the final state of the machine, not the commands you typed. Values like names and ports are generated for you.
Your machine is ready to start
Create a free account to open a machine and get graded.