Skip to content

Instantly share code, notes, and snippets.

@Wilfred
Last active February 6, 2016 10:33
Show Gist options
  • Save Wilfred/d22162181b00d88791a6 to your computer and use it in GitHub Desktop.
Save Wilfred/d22162181b00d88791a6 to your computer and use it in GitHub Desktop.
A demo of a shell script with clear coloured output
#!/bin/bash
BLACK=$(tput setaf 0)
BLUE=$(tput setaf 1)
GREEN=$(tput setaf 2)
CYAN=$(tput setaf 3)
RED=$(tput setaf 4)
MAGENTA=$(tput setaf 5)
YELLOW=$(tput setaf 6)
WHITE=$(tput setaf 7)
BOLD=$(tput bold)
RESET=$(tput sgr0)
echo -e "$BOLD$GREEN==>$WHITE Doing something $RESET"
echo 'Output'
echo 'More output.'
echo -e "$BOLD$GREEN==>$WHITE Doing another thing $RESET"
echo 'Output'
echo 'Yet more output.'
echo -e "$BOLD$GREEN==>$WHITE Summary $RESET"
echo 'Coloured scripts are great!'
@Wilfred
Copy link
Author

Wilfred commented Jul 10, 2014

shell_color

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment