3/15

A Script with Arguments and Exit Codes

easy 10 XP ~6 minHands-on lab

Every good command-line tool tells you how to use it when you call it wrong. Write one.

Task

Create the executable script /home/student/bin/greet.sh that behaves exactly like this:

CallPrints to stdoutPrints to stderrExit code
greet.sh SaraHello, Sara!nothing0
greet.sh "Mary Ann"Hello, Mary Ann!nothing0
greet.shnothingusage: greet.sh NAME2
greet.sh a bnothingusage: greet.sh NAME2

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.

TerminalNot started

Your machine is ready to start

Create a free account to open a machine and get graded.