Output in Linux Console
2013-02-17 13:34
323 查看
1. echo
echo can set the text attributes and color:
usage:
attribute_code: 00-none 01-bold 04-underscore 05-blink 07-reverse 08-concealed
text_color_code: 30-black 31-red 32-green 33-yellow 34-blue 35-magenta 36-cyan 37-white
background_color_code: 40-black 41-red 42-green 43-yellow 44-blue 45-magenta 46-cyan 47-white
2. printf
It uses the same parameter format with the printf function in language C. Using space as the parameter separater.
i=3; j=5; let sum=i+j; echo "sum = $sum";
echo can set the text attributes and color:
echo -e "\e[1;31m This is the red text \e[0m;
usage:
echo -e "\e[attribute_code;text_color_code;background_color_codem text_content \e[0m"
attribute_code: 00-none 01-bold 04-underscore 05-blink 07-reverse 08-concealed
text_color_code: 30-black 31-red 32-green 33-yellow 34-blue 35-magenta 36-cyan 37-white
background_color_code: 40-black 41-red 42-green 43-yellow 44-blue 45-magenta 46-cyan 47-white
2. printf
It uses the same parameter format with the printf function in language C. Using space as the parameter separater.
printf "%-5s %-10s %-4s" No Name Core printf "%-5d %-10s %-4.2f" 1 Tom 70.231
相关文章推荐
- Eclipse CDT using MinGW does not output in console
- How to Output a List of Files to a File and Sort Them in Linux
- How to change the output color of echo in Linux
- no output in console for unittests in pycharm 2017
- (OK) using persistant storage in linux kernel - /sys/fs/pstore/console-ramoops .
- (OK) using persistant storage in linux kernel - /sys/fs/pstore/console-ramoops
- Boot into console mode in Linux
- one trick---Add console output in WinForm
- Silence output of return object in IRB console on windows
- Piping and Redirection,output,Reading from STDIN in script(Linux)
- [c#] where to see console.write output in visual studio?
- [Linux cmd line] How to convert a binary file into output in C include file style.
- LinuxDeepin/dpkg安装软件与Linux软件包依赖介绍
- linux 下搭建Nginx+php报错open_basedir restriction in effect. File(/var/www/html/index.php) is not within
- the diary of pipe in linux
- linux系统weblogic服务器Console控制台密码忘记如何修改
- 轻松打造Linux移动平台–UNetbootin
- Concurrency and Race Condition in Linux 2.6
- Printf() debugging in a console window from within an ActiveX control
- build vsftpd in linux as 4.5