Why does wc <<<"$string" show a one-byte-longer length than printf "$string" | wc? – unix.stackexchange.com

Accidentially, I found out that wc counts differently depending on how it gets the input from bash: $ s='hello' $ wc -m <<<"$s" 6 $ wc -c <<<"$s" 6 $ printf "$s" | wc -m 5 $ printf ...

from Hot Questions - Stack Exchange OnStackOverflow
via Blogspot

Share this

Artikel Terkait

0 Comment to "Why does wc <<<"$string" show a one-byte-longer length than printf "$string" | wc? – unix.stackexchange.com"