I am trying to calculate multiplication of number of arguments and first argument provided by the customer. here the arguments are 10, 15 so total number of arguments is 2. Now i want the shell to perform 2*10(since 10 is the first argument). Instead of the answer I am getting the code as result.
the program I've written:
r=$(echo "$1 \* $#")
echo "Following are the numbers you entered $@ "
echo "first number : $1. and second number: $2."
echo "total number of entered numbers: $#"
echo "expected result: $r"
result:
root@LAPTOP-J:~# bash test.sh 10 15
Following are the numbers you entered 10 15
first number : 10. and second number: 15.
total number of entered numbers: 2
expected result: 10 \* 2
root@LAPTOP-J5JNFL7K:~#

bcmaybe runman bc$r?