I need to make a script in bash to keep a running count based on user keyboard input
if i type "1" i want a variable $h to increment +1 if i type "2" i want a variable $L to decrement -1
and i want to have variable $c output the sum of the first two variables.
i have tried this: to no avail
#!/bin/bash h='0' l='0' read card if [$card='1'] then let "h++" fi if [$card='2'] then let "l--" fi c=$(($h+$l)) echo $c`
Where am i screwing up?