Reputation: 11
Say I have something like
if [[ "$age" = "12" ]]; then
"$age" = "twelve"
fi
This still returns the number itself. How can I make it become twelve?
Upvotes: 0
Views: 399
Reputation: 34934
Your syntax for assigning a variable is wrong. You can't have whitespace around the "=" and the variable being assigned should not be expanded with "$":
age="twelve"
The following is a good guide for learning basics and bash syntax: http://mywiki.wooledge.org/BashGuide/
Upvotes: 4
Reputation: 13196
This ought to do it.
if [[ "$age" = "12" ]]; then
age="twelve"
fi
Read up on variable assignment in bash.
Upvotes: 2