I am having a problem understanding how the character classes work using Posix. I am trying to extract a single digit from a string as follows:
rowa='1 2 3 4 5'
rowb=`echo $rowa |awk '{print $1,$2,$3,$4}'
for i in "$rowb
do
if [ "${i+[3[:digit:]}" = "3" ] # <- This returns1! Syntax problem!
then
echo "$i"
fi
done
rowa='1 2 3 4 5'
rowb=`echo $rowa |awk '{print $1,$2,$3,$4}'
for i in "$rowb
do
if [ "${i+[3[:digit:]}" = "3" ] # <- This returns1! Syntax problem!
then
echo "$i"
fi
done