Add bash scripts

This commit is contained in:
2025-10-14 21:38:29 +02:00
commit 0d07d33c59
6 changed files with 88 additions and 0 deletions

18
scripts/fruits.sh Normal file
View 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"