Register now and start sharing your code snippets.
-->

Appending strings in bash without the line feed.

Shell Script (Bash) posted 5 months ago by marko

To append to a stream in bash without the trailing line feed use printf to format the output before appending it to the stream.

   1  i=42
   2  FILE=/tmp/atm
   3  printf "%s" "${i}" > $FILE

Tagged bash, printf, streams, linux