Search code examples
shellscriptingnewlineline-breakssh

Remove line breaks in Bourne Shell from variable


In bourne shell I have the following:

VALUES=`some command that returns multiple line values`

echo $VALUES

Looks like:

"ONE"
"TWO"
"THREE"
"FOUR"

I would like it to look like:

"ONE" "TWO" "THREE" "FOUR"

Can anyone help?


Solution

  • echo $VALUES | tr '\n' ' '