Browse Source

fix(hard-conditions): creating the files in the test and removing unnecessary folder

adding details in the readme
pull/1724/head
miguel 2 years ago committed by MSilva95
parent
commit
74c7460405
  1. 0
      sh/tests/hard-conditions/non-ex
  2. 1
      sh/tests/hard-conditions/test-hard-conditions.sh
  3. 14
      sh/tests/hard-conditions_test.sh
  4. 8
      subjects/devops/hard-conditions/README.md

1
sh/tests/hard-conditions/test-hard-conditions.sh

@ -1 +0,0 @@
echo "hello world"

14
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")

8
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!

Loading…
Cancel
Save