Skip to content

Commit

Permalink
Improve description of error handling exercise
Browse files Browse the repository at this point in the history
  • Loading branch information
rsp committed Jan 12, 2025
1 parent c8298b0 commit fe5172c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions exercises/practice/error-handling/.docs/instructions.append.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,15 @@
## Bash-specific instructions

The goal of this exercise is to consider the number of arguments passed to your program.
If there is exactly one argument, print a greeting message.
Otherwise print an error message and exit with a non-zero status.

Note that you can pass empty strings as arguments:

`./program ""`

and it is not the same as not passing the argument at all:

`./program`

In this excercise, if your program is run with exactly one argument (even if it is an empty string), treat is as a person's name and print a greeting message, eg. `"Hello, Kate"` (or `"Hello, "` for the empty string).

Otherwise if it is run with no arguments or more than one argument, print an error message `"Usage: error_handling.sh <person>"` and exit with a non-zero status.

0 comments on commit fe5172c

Please sign in to comment.