Hello, I was testing one parameter in my .sh and realised that the wc command return a different value that I was expected. I send you a couple examples.
I have to validate a celular telephone number (in Argentina), so, it has to be a 10 chars parameter.
sarasa() -- seba > echo 1029384756 | wc -c
11
sarasa () -- seba > echo "1029384756" | wc -c
11
sarasa () -- seba > echo 1029384756 | wc -m
11
sarasa () -- seba > echo "1029384756" | wc -m
11
I got the correct value only with the “–L” option.
sarasa () -- seba > echo 1029384756 | wc -L
10
sarasa () -- seba > echo "1029384756" | wc -L
10
I tested it (with same output) in:
Linux 2.6.9-78.0.22.ELlargesmp #1 SMP Fri Apr 24 12:59:13 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
and
Linux 3.2.0-29-generic-pae #46-Ubuntu SMP Fri Jul 27 17:25:43 UTC 2012 i686 i686 i386 GNU/Linux
Regards! (and excuse me for my bad english)
Seba