0

Look at this folks

r1=$(grep -c "Error_type1" file.txt)

r2=$(grep -c "Error_type2" file.txt)

all fine until here, but if I try to print total of errors:

echo $r1+$r2  

$1+1

echo $(r1+r2)  

$command not found

echo $($r1+$r2)

$command not found

I don´t wanna create a 3rd variable with the sum. Any ideas?

Cyrus
  • 84,225
  • 14
  • 89
  • 153

0 Answers0