Skip to content

Commit

Permalink
Done with mandatory task 1 - 7
Browse files Browse the repository at this point in the history
  • Loading branch information
Baribor committed Sep 28, 2023
1 parent 78d2e8b commit 88394ca
Show file tree
Hide file tree
Showing 10 changed files with 88 additions and 0 deletions.
7 changes: 7 additions & 0 deletions 0x04-loops_conditions_and_parsing/1-for_best_school
100644 → 100755
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
#This script prints "Best School" 10 times

for _ in {1..10};
do
echo "Best School"
done
Empty file modified 0x04-loops_conditions_and_parsing/10-fizzbuzz
100644 → 100755
Empty file.
9 changes: 9 additions & 0 deletions 0x04-loops_conditions_and_parsing/2-while_best_school
100644 → 100755
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
#This script prints "Best School" 10 times

n=0
while [ $n -lt 10 ];
do
echo "Best School"
((n++))
done
9 changes: 9 additions & 0 deletions 0x04-loops_conditions_and_parsing/3-until_best_school
100644 → 100755
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
#This script prints "Best School" 10 times

n=0
until [ $n == 10 ];
do
echo "Best School"
((n++))
done
13 changes: 13 additions & 0 deletions 0x04-loops_conditions_and_parsing/4-if_9_say_hi
100644 → 100755
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
#displays Best School 10 times, but for the 9th iteration, displays Best School and then Hi on a new line

n=0
while [ $n -lt 10 ];
do
echo "Best School"
if [ $n == 8 ];
then
echo "Hi"
fi
((n++))
done
15 changes: 15 additions & 0 deletions 0x04-loops_conditions_and_parsing/5-4_bad_luck_8_is_your_chance
100644 → 100755
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
# script that loops from 1 to 10
n=1

while [ $n -le 10 ];
do
if [ $n == 4 ]; then
echo "bad luck"
elif [ $n == 8 ]; then
echo "good luck"
else
echo "Best School"
fi;
((n++))
done
18 changes: 18 additions & 0 deletions 0x04-loops_conditions_and_parsing/6-superstitious_numbers
100644 → 100755
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
# script that loops from 1 to 10
n=1

while [ $n -le 20 ];
do
case $n in
4) echo "bad luck from China"
;;
9) echo "bad luck from Japan"
;;
17) echo "bad luck from Italy"
;;
*) echo $n
;;
esac
((n++))
done
17 changes: 17 additions & 0 deletions 0x04-loops_conditions_and_parsing/7-clock
100644 → 100755
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
# script that displays the time for 12 hours and 59 minutes

sec=0
hr=0

while [ $hr -le 12 ];
do
sec=0
echo "Hour: $hr"
while [ $sec -le 59 ];
do
echo $sec
((sec++))
done
((hr++))
done
Empty file modified 0x04-loops_conditions_and_parsing/8-for_ls
100644 → 100755
Empty file.
Empty file modified 0x04-loops_conditions_and_parsing/9-to_file_or_not_to_file
100644 → 100755
Empty file.

0 comments on commit 88394ca

Please sign in to comment.