Skip to content

Instantly share code, notes, and snippets.

@dshipp
Created October 9, 2013 10:37
Show Gist options
  • Save dshipp/6899306 to your computer and use it in GitHub Desktop.
Save dshipp/6899306 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Colours
ESC_SEQ="\x1b["
COL_RESET=$ESC_SEQ"39;49;00m"
COL_RED=$ESC_SEQ"31;01m"
COL_GREEN=$ESC_SEQ"32;01m"
COL_YELLOW=$ESC_SEQ"33;01m"
COL_BLUE=$ESC_SEQ"34;01m"
COL_MAGENTA=$ESC_SEQ"35;01m"
COL_CYAN=$ESC_SEQ"36;01m"
echo -e "${COL_RED}You can colourize output by adding -e to the echo command and including one of the colour codes we set up"
ls
echo "If you don't use \$COL_RESET then the colour will continue to be used, including output of commands. the output of ls will have been red."
echo -e "${COL_RESET}Now colours have been set back to normal"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment