I have the following code snippet from a bash script with example values for TS_ID and one_ts:
<code> TS_ID="1234"
one_ts="abc defghij"
if ! echo "$one_ts" | grep -q " " ; then
echo "TScr: $TS_ID - did not find nbsp"
else
echo "TScr: $TS_ID - found nbsp"
fi
</code>
<code> TS_ID="1234"
one_ts="abc defghij"
if ! echo "$one_ts" | grep -q " " ; then
echo "TScr: $TS_ID - did not find nbsp"
else
echo "TScr: $TS_ID - found nbsp"
fi
</code>
TS_ID="1234"
one_ts="abc defghij"
if ! echo "$one_ts" | grep -q " " ; then
echo "TScr: $TS_ID - did not find nbsp"
else
echo "TScr: $TS_ID - found nbsp"
fi
note:
is the numerical equivalent of the non-breaking space character. The data is actually being read from a UTF8 csv file.
when one_ts contains a single   the if/then/else does not detect it (did not find nbsp) but if it contains two or more consecutive   then they are detected (found nbsp).
Why is it not finding the first/only non-breaking space character but is finding 2 or more consecutive nbsp’s?
10