Concatenate output of two commands into one line Concatenate output of two commands into one line bash bash

Concatenate output of two commands into one line


You could pass the -n option to your first echo command, so it doesn't output a newline.


As a quick demonstration, this :

echo "test : " ; echo "blah"

will get you :

test : blah

With a newline between the two outputs.


While this, with a -n for the first echo :

echo -n "test : " ; echo "blah"

will get you the following output :

test : blah

Without any newline between the two output.


The (GNU version of) echo utility has a -n option to omit the trailing newline. Use that on your first echo. You'll probably have to put some space after the first line or before the second for readability.