Linux system can modify the color of the shell script output text, so that it can be distinguished from other text, so that users can distinguish the output text. So how to modify the color of the Linux system shell script output text?
Shell Function:
echocolor(){
color=${1} && shift
case ${color} in
black)
echo -e “\\e[0;30m${@}\\e[0m”
;;
red)
echo -e “\\e[0;31m${@}\\e[0m”
;;
green)
echo -e &ldquo ;\\e[0;32m${@}\\e[0m”
;;
yellow)
echo -e “\\e[0;33m$ {@}\\e[0m”
;;
blue)
echo -e “\\e[0;34m${@}\\e[0m”
;;
purple)
echo -e “\\e[0;35m${@}\\e[0m”
;;
cyan)
echo -e “\\e[0;36m${@}\\e[0m”
;;
*)
echo -e “\\e[0;37m${@}\\e[0m”
;;
esac # --- end of case -- -
}
Example of use:
cd $(dirname $( Readlink -f ${0}))
echocolor purple “》 Current directory: ${PWD}”
modname=$(grep ‘obj-m’ Makefile |
Awk ‘{print $3}& rsquo;) && modname=${modname/.o}
echocolor purple “》 Module Name: ${modname}”
Echocolor yellow “"" Uninstall the old module..”
adb shell rmmod ${modname}
echocolor yellow “"" Compiling..”
make
echocolor yellow “》》 Uploading files..”
adb push k860_words_count.ko /tmp/
echocolor yellow “》》 Installing Module..”
adb shell insmod /tmp/k860_words_count.ko
echocolor cyan “》》 Output debugging information..”
adb shell cat /proc /kmsg |
Grep word
Screenshot:
The above is the modification method of the output color of the Linux system shell script, so that the input text and output text can be easily distinguished to avoid unnecessary Confusion.
The media server has good tailorability and can implement one or more functions. How to build a Linu
In Linux system operation, root usually does not set a password. Once the root password is set, you
When performing Linux multi-terminal operation, if synchronization between differen
node.js can be used not only to write scripts for web pages, but also to run Linux commands on the s
Linux system how to re-mount var partition
Two ways to remove pdf passwords from Linux
What should I do if the Linux system Git cannot exit completely (exit code 128 or 1)?
Summary of zypper command usage in SUSE Linux system
How to limit the access rights of Linux users
How to detect the device name and writing speed of DVD burner under Linux
The nohup command in the Linux system guide
Kali Linux installation Google Chrome common problems and solutions
Detailed steps for mounting Windows shared files in Linux
How does Centos build CDN server through nginx reverse proxy and proxy_cache cache
How to use Linux to use grep command to search for text files
Win8 system login can use the email account
Win7 system google browser font blur can not see clearly how to do
Win7 system local connection is disabled can not be used how to solve?
Bing input method practical tips recommended
How to make Win8 system run faster
Windows 10 Mobile was found to have traffic BUG
Simply replace Win8 background color and texture
What is the command to format the C drive in the Win8 system?