diff --git a/sh/tests/greatest-of-all_test.sh b/sh/tests/greatest-of-all_test.sh index 2e359408..7a4556ed 100755 --- a/sh/tests/greatest-of-all_test.sh +++ b/sh/tests/greatest-of-all_test.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -# Unofficial Bash Strict Mode -# set -euo pipefail IFS=' ' script_dirS=$(cd -P "$(dirname "$BASH_SOURCE")" &>/dev/null && pwd) diff --git a/subjects/devops/greatest-of-all/README.md b/subjects/devops/greatest-of-all/README.md index 8009e68c..2497fc99 100644 --- a/subjects/devops/greatest-of-all/README.md +++ b/subjects/devops/greatest-of-all/README.md @@ -4,11 +4,14 @@ Create a script `greatest-of-all.sh` which will ask you to input 10 numbers and then it will check what was the biggest number given. You must ask for the number using the string "Enter a number: " and then use the string "The largest number is: " to print the output like in the example below. +- Only positive numbers up to "10000" will be tested. +- If the given number is greater than "10000" you must print the error message "ERROR: The number entered is too large" and if its not a number or it is a negative number, print the error "ERROR: Invalid input only positive numerical characters are allowed". When either of these errors occurs, the script will print the error message, exit with an exit code of `1`, and will not continue to execute the next line. + ### Usage ```console $./greatest-of-all.sh -Enter a number: 1 # these numbers will be introduced either the user +Enter a number: 1 # these numbers will be introduced by the user Enter a number: 2 Enter a number: 3 Enter a number: 4 @@ -31,9 +34,6 @@ ERROR: The number entered is too large $ ``` -- Only positive numbers up to "10000" will be tested. -- If the given number is greater than "10000" you must print the error message "ERROR: The number entered is too large" and if its not a number or it is a negative number, print the error "ERROR: Invalid input only positive numerical characters are allowed". When either of these errors occurs, the script will print the error message, exit with an exit code of `1`, and will not continue to execute the next line. - ### Hints The `if` condition in the shell is a control structure that allows you to execute a command or block of commands based on a specified condition. The if condition has the following syntax: