Untitled
unknown
plain_text
2 years ago
763 B
4
Indexable
#!/bin/bash read -p "How many calculations do you wish to do? " num_calcs for (( i=1; i<=$num_calcs; i++ )) do read -p "Enter the first number: " num1 read -p "Enter the second number: " num2 echo "What operation do you want to perform?" echo "1. Addition" echo "2. Subtraction" read -p "Enter your choice (1 or 2): " choice case $choice in 1) result=$((num1+num2)) echo "The sum of $num1 and $num2 is $result" ;; 2) result=$((num1-num2)) echo "The difference between $num1 and $num2 is $result" ;; *) echo "Invalid choice. Please enter 1 or 2." ;; esac echo done
Editor is loading...