bash: echo colours and text formatting

This is a wiki page. Be bold and improve it!

If you have any questions about the content on this page, don't hesitate to open a new ticket and we'll do our best to assist you.

Do not forget the -e switch to echo tabs (\t) and new lines (\n).

#!/bin/bash

# The following does not work:
echo "This is a tab \t and that \n was a new line."
echo "Here is some "\t\033[1;33m""colour""\033[0m!"

# This works:
echo -e "This is a tab \t and that \n was a new line."
echo -e "Here is some "\t\033[1;33m""colour""\033[0m!"

For more information, check man echo