While read -r line; do # $'n' prints a newline so we don't have to understand what Distinctive chars the string incorporates stringBuilder+="$line"$'n' However if you ended up to interchange printf with echo in this instance, echo would take care of n to be a string, So disregarding the intent https://ticketsbookmarks.com/story20099210/the-smart-trick-of-cat-store-that-no-one-is-discussing