Variables and escape characters?
Hello all. I am supposed to write a simple script in bash for class, and have been having a heck of a time with something that should *probably* be pretty simple, here is what I need (or want, anyway)...
I am writing a script that does arithmetic via the commandline, for instance "./arithmetic 3 * 2" should output "3 * 2 = 6". So here is what I have written:
echo $1 $2 $3 = $(( $1$2$3 ))
Which works fine for everything except multiplication, since the asterisk gets interpreted as a wildcard. So, is it possible to make the script interpret it as the multiplication operator without entering an escape character into the command? Should I be using let instead?
Here are some rules for the writing of the script as given from my instructor:
"Your script should NOT use any conditional or repetition type statements.
Thanks in advance.