user454038 and Cyrus correctly described how to fix your problem,
but not what you're doing wrong.
In the shell (or at least in bash) you use
when you're referencing the value of a variable,
but not when you're referencing the variable itself
(i.e., when you're setting the value).
This is confusing; in most (all?) normal programming languages,
you use the same syntax either way.
You seem to understand this concept partially; you say
num=$(($num1 + $num2))
rather than making the common mistake of saying
$num=$(($num1 + $num2)) (Don't do this!)
This applies to the
read statement, too.
When you say
read $opr, the
$opr gets expanded
(i.e., replaced with the current value of the
opr variable) —
and the current value of the
opr variable is an empty string.
So the command ends up looking like
And you might expect that to be an error;
in fact, it is equivalent to
read REPLY. So,
$ read $num1
$ echo $num1
(Blank line output)
$ echo $REPLY
This example might illustrate the mechanism better:
$ read $superman
man of steel
$ echo $superman
$ echo $clark_kent
man of steel
But you shouldn't do things like this (especially the above example)
because they are too cryptic;
readers/maintainers will have trouble understanding what the code is doing.
read statements should be
read num1, and