Parse Flags with getopts
Write the executable script /home/student/bin/deploy.sh with this interface:
deploy.sh [-e ENV] [-n] [-v] SERVICE
-e ENV picks the environment: staging or production. The default is staging.-n it prints deploying SERVICE to ENV. With -n (dry run) it prints DRY RUN: deploying SERVICE to ENV instead. Both go to stdout and the script exits 0.-v additionally prints verbose: on to stderr.-nv).2 with the line usage: deploy.sh [-e ENV] [-n] [-v] SERVICE on stderr when: SERVICE is missing, an unknown option is given, -e has no value, or ENV is not staging or production.For example, deploy.sh -n -e production pulse prints DRY RUN: deploying pulse to production.
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.