Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve description of Error Handling exercise #719

Merged
merged 5 commits into from
Jan 19, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
rsp marked this conversation as resolved.
Show resolved Hide resolved

`./program ""`

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You wrote

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

Perhaps

which is different from passing no arguments at all:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds better, thanks. Changed in 079cb20


`./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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's necessary to spell out the exact greeting or the exact error. Students are expected to read the tests to determine the complete requirements.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good point 👍 I removed the exact greeting and error in 079cb20