View Single Post
Old 03-28-2012, 05:11 PM   #26
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Yup, looks like it gets stripped:
Code:
core2quad $ sh
$ ST="_ _" ; L=' ' ; ST="$ST$L" ; echo ${#ST}
4
$ ST="_ _" ; L=' ' ; ST="$(echo $ST$L)" ; echo ${#ST}
3
The same behavior will be seen where you try to return a string with a trailing IFS character at the end of the function, unless you escape the string.

Use the %q format to printf rather than echo to return a string that might have a trailing IFS character.
knc1 is offline   Reply With Quote