To transform your multi-line cat heredoc into a single-line Bash command, you can use echo with a newline delimiter or printf. Here are two concise options:
echo and a newlinebashecho -e "a\nb\nc" >> ~/test.txt
printfbashprintf "a\nb\nc\n" >> ~/test.txt
Both commands append the lines a, b, and c to ~/test.txt in a single line. The -e flag in echo enables interpretation of backslash escapes, and printf automatically interprets \n as a newline.
Vibe can make mistakes. Check answers. Learn more