I have two scripts that work together by themselves and I have no idea how to make them work together
the task is to make a bash script accept operators and a list of integers and having the command perform the operations.
I basically need to be able to use the script as such
test.sh add 1 2 3
5
test.sh sub 4 2 1
1
the first script I have is
for var in $@
do
sum=$(( sum + var ))
done
echo $sum
second script is
if [ $operator = add ]; then
add= echo $(($a+$b))
elif
I'm not really sure how to combine them to make it so I can get
test.sh add 1 2 3
5