Reputation: 719
Here is my script:
mean1=$4.77953
echo "Mean: $mean1"
But instead of printing Mean: 4.77953
it prints Mean: .77953
. What is causing this?
Upvotes: 1
Views: 212
Reputation: 16624
Bash thinks $4
is a variable (the 4th argument passed to your script) in your mean1 declaration and this one is not set.
Upvotes: 2
Reputation: 1925
Bash is expanding $4
to the fourth argument of your script. You should single quote your string in order to avoid the expansion.
mean1='$4.77953'
Upvotes: 1