I have some command which produces output with no new line at the end, like this
Myprompt$ somecmd
dksfjdl
dsfjdlkfj
dsfjdkfj
dfjdkfjMyprompt$
Currently I overcome this by somecmd | sed 's/$/\n/' | tr -s '\n'
Is there a better way to do this?
|
I have some command which produces output with no new line at the end, like this
Currently I overcome this by |
|||
|
|
|
Just run echo after it, it should generate a newline
And If you need to feed it to something else, run it in a sub-shell:
Or.. as @camh points out, the subshell is actually not needed you can execute it with a command list in the current shell environment with:
|
|||||||||||||
|
|
Feed it through some utility which read input in lines and output lines, like in |
|||
|
|