Yes. Use the -n
option:
echo -n "$x"
From help echo
:
-n do not append a newline
This would strips off the last newline too, so if you want you can add a final newline after the loop:
for ...; do ...; done; echo
Note:
This is not portable among various implementations of echo
builtin/external executable. The portable way would be to use printf
instead:
printf '%s' "$x"