Add bash scripts
This commit is contained in:
18
scripts/fruits.sh
Normal file
18
scripts/fruits.sh
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
liked_count=0
|
||||
total_count=0
|
||||
|
||||
|
||||
for fruit in banana apple strawberry; do
|
||||
read -p "Do you like $fruit (y/n): " answer
|
||||
if [[ "$answer" == y* ]]; then
|
||||
liked_count=$(( liked_count + 1 ))
|
||||
fi
|
||||
|
||||
total_count=$(( total_count + 1 ))
|
||||
done
|
||||
|
||||
echo "Liked $liked_count fruits out of $total_count"
|
||||
Reference in New Issue
Block a user