shell - Assign new value to variable fails -


why not work:

if [ $_type == 1 ] || [ $_type == 2 ];                 $_type=$(echo "outbound"); fi  or  if [ $_type == 1 ] || [ $_type == 2 ];                 $_type=echo "outbound"; fi  or  if [ $_type == 1 ] || [ $_type == 2 ];                 $_type="outbound"; fi 

i'm receiving error: line 251: 2=outbound: command not found

in posix shells such bash, $ not part of variable-name, it's notation expanding variable (to obtain value); so, example, echo "$_type" prints value of variable _type. don't use $ when you're assigning variable. need:

if [[ "$_type" = 1 || "$_type" = 2 ]] ;     _type=outbound fi 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -