diff --git a/sh/tests/hard-conditions/non-ex b/sh/tests/hard-conditions/non-ex deleted file mode 100644 index e69de29bb..000000000 diff --git a/sh/tests/hard-conditions/test-hard-conditions.sh b/sh/tests/hard-conditions/test-hard-conditions.sh deleted file mode 100755 index b1e4199f1..000000000 --- a/sh/tests/hard-conditions/test-hard-conditions.sh +++ /dev/null @@ -1 +0,0 @@ -echo "hello world" diff --git a/sh/tests/hard-conditions_test.sh b/sh/tests/hard-conditions_test.sh index 35a2fc9be..a4b906b8f 100755 --- a/sh/tests/hard-conditions_test.sh +++ b/sh/tests/hard-conditions_test.sh @@ -5,9 +5,15 @@ set -euo pipefail IFS=' ' script_dirS=$(cd -P "$(dirname "$BASH_SOURCE")" &>/dev/null && pwd) -submitted=$(bash "$script_dirS"/student/hard-conditions.sh hard-conditions/test-hard-conditions.sh) -expected=$(bash "$script_dirS"/solutions/hard-conditions.sh hard-conditions/test-hard-conditions.sh) + +echo "echo hello word" >test-hard-conditions.sh +echo "echo hello word" >non-ex +chmod +x test-hard-conditions.sh + +submitted=$(bash "$script_dirS"/student/hard-conditions.sh test-hard-conditions.sh) +expected=$(bash "$script_dirS"/solutions/hard-conditions.sh test-hard-conditions.sh) diff <(echo "$submitted") <(echo "$expected") -submitted=$(bash "$script_dirS"/student/hard-conditions.sh hard-conditions/non-ex) -expected=$(bash "$script_dirS"/solutions/hard-conditions.sh hard-conditions/non-ex) + +submitted=$(bash "$script_dirS"/student/hard-conditions.sh non-ex) +expected=$(bash "$script_dirS"/solutions/hard-conditions.sh non-ex) diff <(echo "$submitted") <(echo "$expected") diff --git a/subjects/devops/hard-conditions/README.md b/subjects/devops/hard-conditions/README.md index c3fde37cd..b0702928f 100644 --- a/subjects/devops/hard-conditions/README.md +++ b/subjects/devops/hard-conditions/README.md @@ -29,9 +29,9 @@ $ test EXPRESSION $ [ EXPRESSION ] ``` -In a shell script, $1 is a special variable that refers to the first argument passed to the script. Arguments are values that are passed to the script when it is run, and they can be used to modify the behavior of the script or provide input to it. +In a shell script, `$1` is a special variable that refers to the first argument passed to the script. Arguments are values that are passed to the script when it is run, and they can be used to modify the behavior of the script or provide input to it. -Here is an example of a simple shell script that prints the value of $1: +Here is an example of a simple shell script that prints the value of `$1`: ```console #!/bin/bash @@ -43,7 +43,9 @@ echo "The first argument is: $1" To run this script and pass an argument to it, you can use the following command: ```console -./script.sh arg1 +$ ./script.sh hello +The first argument is: hello +$ ``` > You have to use Man or Google to know more about commands flags, in order to solve this exercise!