Lets say I have a word of length N
.
word0=`echo` # N = 0
word1=`echo A` # N = 1
word2=`echo AB` # N = 2
word5=`echo ABCDE` # N = 5
word4=`echo "ABCD"` # N = 4
I use wc
to get the length ofwordN
, for example:
echo $word0 | wc
1
echo $word1 | wc
2
echo $word4 | wc
5
wc
adds +1 to the word length and result is N+1
Even with wc -c
or wc -m
I got N+1
Question: Should wc
work like this? If so, why it adds +1?