Reputation: 1639
why this do not work:
if [ $_TYPE == 1 ] || [ $_TYPE == 2 ]; then
$_TYPE=$(echo "Outbound");
fi
or
if [ $_TYPE == 1 ] || [ $_TYPE == 2 ]; then
$_TYPE=echo "Outbound";
fi
or
if [ $_TYPE == 1 ] || [ $_TYPE == 2 ]; then
$_TYPE="Outbound";
fi
I'm receiving this error: line 251: 2=Outbound: command not found
Upvotes: 0
Views: 57
Reputation: 2397
$ is used to access the value, but if you have to assign a value, the syntax is :
_TYPE="newValue"
Upvotes: 1
Reputation: 183270
In POSIX shells such as Bash, $
is not part of the variable-name, it's just the notation for expanding the variable (to obtain its value); so, for example, echo "$_TYPE"
prints the value of the variable _TYPE
. You don't use the $
when you're assigning to the variable. So you just need:
if [[ "$_TYPE" = 1 || "$_TYPE" = 2 ]] ; then
_TYPE=Outbound
fi
Upvotes: 3