Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

how to change colors in terminal linux outputs

#!/bin/sh
MOVE_UP=`tput cuu 1`
CLEAR_LINE=`tput el 1`
BOLD=`tput bold`
UNDERLINE=`tput smul`
RESET=`tput sgr0`
echo "This is normal text"
sleep 1
echo "${MOVE_UP}${CLEAR_LINE}${BOLD}This is bolded"
sleep 1
echo "${MOVE_UP}${CLEAR_LINE}${UNDERLINE}This is underlined${RESET}"
Source by www.baeldung.com #
 
PREVIOUS NEXT
Tagged: #change #colors #terminal #linux #outputs
ADD COMMENT
Topic
Name
9+6 =