Tracks
/
Bash
Bash
/
Exercises
/
Error Handling
Error Handling

Error Handling

Easy

Instructions

Implement various kinds of error handling and resource management.

An important point of programming is how to handle errors and close resources even if errors occur.

This exercise requires you to handle various errors. Because error handling is rather programming language specific you'll have to refer to the tests for your track to see what's exactly required.

Bash-specific instructions

The goal of this exercise is to consider the number of arguments passed to your program.

Note that you can pass empty strings as arguments.

./program ""

This is different from passing no arguments at all.

./program

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. If it is run with zero arguments or more than one argument, print an error message and exit with a non-zero status.

Edit via GitHub The link opens in a new window or tab
Bash Exercism

Ready to start Error Handling?

Sign up to Exercism to learn and master Bash with 92 exercises, and real human mentoring, all for free.