I’m using a serial terminal to provide input into our lab experiment. I found that using
$ echo "5X5"
just returns a string of "5X5". Is there a command to execute a multiplication operation?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, you can use bash’s built-in Arithmetic Expansion
$(( ))to do some simple mathsCheck the Shell Arithmetic section in the Bash Reference Manual for a complete list of operators.
For sake of completeness, as other pointed out, if you need arbitrary precision,
bcordcwould be better.