I've got a string h="aaaa bbb"
which contains 2 spaces between aaaa and bbb,and I want to count the number of spaces in it.However,when I try
echo $h|grep -o ' '|wc -l
it shows 1 instead of the desired two. Is there any way not to treat consecutive spaces in string as one?