Hi I am doing a project where I must write a bash script calculator that allows you to perform multiple arithmetic operations and also to the power of. I have done the basic bit but have been told I must make it non interactive and was just wondering how would I do this? My code has been provided below.
clear bash while [ -z "$arg1" ] do read -p "Enter argument1: " arg1 done while [ -z "$arg2" ] do read -p "Enter argument2: " arg2 done echo "You've entered: arg1=$arg1 and arg2=$arg2" let "addition=arg1+arg2" let "subtraction=arg1-arg2" let "multiplication=arg1*arg2" let "division=arg1 / arg2" let "power=arg1**arg2" echo -e "results:\n" echo "$arg1+$arg2=$addition" echo "$arg1-$arg2=$subtraction" echo "$arg1*arg2=$multiplication" echo "$arg1/$arg2=$division" echo "$arg1^$arg2=$power" I was thinking of trying to make it so that the user does not have to type in 2 numbers but I am still pretty new to bash and scripts as a whole so I am wondering how to do this.
$1,$2, etc.