Files
next-git/scripts/fruits.sh
2025-10-14 21:38:29 +02:00

19 lines
317 B
Bash

#!/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"