diff --git a/exitCodeOperations/testswithoutif b/exitCodeOperations/testswithoutif new file mode 100755 index 0000000..84a1e61 --- /dev/null +++ b/exitCodeOperations/testswithoutif @@ -0,0 +1,10 @@ +#!/bin/bash +param=1 + +[[ "$param" -eq 1 ]] && echo "logic operator && grabs the exit code of the [[ ]] test if return code eq 0\"sucess\" run the following commands" + +[[ "$param" -eq 2 ]] || echo "logic operator && grabs the exit code of the [[ ]] test if return code ne 0 \"not sucess\" run the following commands" + +[[ "$param" -eq 1 ]] &&( echo "this spwan a subshell if you need to run multiples commands" ;echo "if the previos operation was sucessfull") + +[[ "$param" -eq 1 ]] && { echo "this doesn't spwan a subshell " ;echo "run multiples commands if the previos operation was sucessfull" ;} diff --git a/ifElse/case.sh b/ifElse/case.sh index c13055e..b6af9ec 100644 --- a/ifElse/case.sh +++ b/ifElse/case.sh @@ -1,5 +1,5 @@ #!/bin/bash -read -p "Enter the answer in Y/N: " ANSWER +read -r -p "Enter the answer in Y/N: " ANSWER case "$ANSWER" in [yY] | [yY][eE][sS]) echo "The Answer is Yes :)" @@ -10,4 +10,4 @@ case "$ANSWER" in *) echo "Invalid Answer :/" ;; -esac \ No newline at end of file +esac diff --git a/practise1/prog10.sh b/practise1/prog10.sh index 8b01c9b..3958316 100644 --- a/practise1/prog10.sh +++ b/practise1/prog10.sh @@ -1,8 +1,8 @@ #!/bin/bash function fileCount () { LOC=$1 - ls $LOC > outText.txt + ls "$LOC" > outText.txt NUM_FILES=$(wc -w outText.txt) - echo $NUM_FILES + echo "$NUM_FILES" } -fileCount /etc \ No newline at end of file +fileCount /etc