I have a query that returns some numbers from the db and I'm trying to put that into a file to send out. However, some of the values come back as null and I'm trying to substitute '0' in for some calculations in those cases. The only time I can get it to '0' it also does that for variables that have actual values. Below is my code and output. What am I doing wrong? (Very new to bash/Linux.)
I use these commands: and I get this output:
echo ${awb-$defaultbase} NULL
echo ${gachurn-$defaultbase} 2 -
echo ${awb+$defaultbase} 0
echo ${gachurn+$defaultbase} 0 -
echo ${awb:-$defaultbase} NULL
echo ${gachurn:-$defaultbase} 2 -
echo ${awb:+$defaultbase} 0
echo ${gachurn:+$defaultbase} 0 -
echo $awb NULL
echo $gachurn 2
I want the first value to be 0 and the second to be 2.