Reputation: 430
When I run the script I get the following errors. What am I doing wrong here please? Any help appreciated- Bash Newbie
Error:
line 12: 0=1: command not found
line 13: 0=1: command not found
My Script:
count_raw=0
avg_raw=0
$count_raw=1
$avg_raw=1
echo "count_raw=$count_raw"
echo "avg_raw=$avg_raw"
Upvotes: 1
Views: 463
Reputation: 229
=
is an assignment operator when found free and $
holds value (not only in USA but in bash too) of a variable.
So when you say: $var=1
, you're essentially trying to type a random string (0=1
in your case) in bash and bash doesn't like that. Look at the one-liner below that shows one example where you'd type in $var=1
and bash would be able to process it:
var=1; if [[ $var=1 ]]; then printf "Congrats! You have learned the difference between variable assignment and variable comparison in the ${var}st attempt.\n"; fi;
Upvotes: 1