Let's say we run two programs in the Linux shell, on one line, like this:
who -r; date
What should I add to obtain one line output?
printf "%s %s\n" "$(who -r)" "$(date)"
Lots of quotes, but all are required. More simply:
echo $(who -r; date)
This one purposefully has no quotes.
Another option that does not require all the output from the commands to be captured: groups the commands together and pipe the combined output through paste
{ who -r; date; } | paste -s -d ' '
outputs something like
run-level 3 Mar 1 19:44 Tue Apr 18 15:10:19 UTC 2023
echo -n `who -r`; echo -n ' '; date
who -r; date