Reputation: 729
Am trying to mulitply a variable with -1 in bash script
this is the code
u=1
u=$(($u * -1))
if [ $u -eq 1 ]
then
rcolor="white"
#-----30
else
rcolor="#E8EDFF"
fi
Output
script.sh: line 2: syntax error near unexpected token `u=$(($u * 1))'
script.sh: line 2: `u=$(($u * 1))'
Upvotes: 1
Views: 144
Reputation: 6642
Try changing it to:
u=1
((u *= -1)) # no $
if [ $u -eq 1 ]
then
rcolor="white"
#-----30
else
rcolor="#E8EDFF"
fi
Upvotes: 1