Don't use $ with the variable name in the declaration/assignment. I.e., size=, not $size=. You can actually do this: echo "echec avec le nom $path qui fait $(echo -n $path | wc -c) caracteres". I've thrown an -n in there because wc counts the newline otherwise, but I've also edited in another method to deal with that above (see last paragraph).
–
goldilocksJul 13 '14 at 13:40

It would be far better if you didn't use echo at all. The use of echo when combined with arbitrary input can have unintended effects. What's more, you do not need wc to count the characters in a shell variable - the shell can do it just as well and without execing a separate process to boot.