Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 10 additions & 0 deletions ex01/hello_world.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

hello_world() {
if [ -n "${1}" ];
then echo "Hello, ${1}!"
else echo "Hello, World!"
fi
}

hello_world $1
13 changes: 13 additions & 0 deletions ex02/ex02.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

for file in $1
do
path=$(ls -R ./ | grep ${file})
if [ -z "${path}" ];

then echo "the searched PATH is unexisting"
else echo "${path}"

fi
done

7 changes: 3 additions & 4 deletions ex02/test_ex02.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#set -xe

@test "Existing path STR" {
run ./ex02.sh "STR"
run bash ex02.sh "STR"
[ "$status" -eq 0 ]
[ "$output" = $'STR\n./resources/FOLDER/STR:' ]
}
Expand All @@ -14,14 +14,14 @@
[ "$output" = $'FOLDER\n./resources/FOLDER:\n./resources/FOLDER/STR:' ]
}

@test "2 existing paths" {
@test "2 existing paths STR FOLDER" {
run bash ex02.sh "STR FOLDER"
[ "$status" -eq 0 ]
[ "$output" = $'STR\n./resources/FOLDER/STR:\nFOLDER\n./resources/FOLDER:\n./resources/FOLDER/STR:' ]
}


@test "2 existing paths" {
@test "2 existing paths FOLDER STR" {
run bash ex02.sh "FOLDER STR"
[ "$status" -eq 0 ]
[ "$output" = $'FOLDER\n./resources/FOLDER:\n./resources/FOLDER/STR:\nSTR\n./resources/FOLDER/STR:' ]
Expand Down Expand Up @@ -61,4 +61,3 @@