当前位置:网站首页>十一、echo
十一、echo
2022-07-26 22:44:00 【JXin-xxx】
十一、echo
echo -n 表示不换行输出
echo -e 输出转义字符,将转义后的内容输出到屏幕上
常用的转义字符如下:
\b:转义后相当于按退格键,但前提是“\b”后面存在字符;“\b”表示删除前一一个字符,“\b\b”表示删除前两个字符。
\c:不换行输出,在“\c”后面不存在字符的情况下,作用相当于echo -n;但是当“\c”后面任然存在字符时,“\c”后面的字符将不会被输出。
\n:换行,被输出的字符从“\n”处开始另起一行
\f:换行,但是换行后的新行的开头位置连接着上一行的行尾;
\v 与 \f 相同;
\t:转义后表示插入tab,即横向制表符 ;
\r:光标移至行首,但不换行,相当于使用“\r”以后的字符覆盖“\r”之前等长度的字符:但是当“\r”后面不存在任何字符时,“\r”前面的字符不会被覆盖;
\ :表示插入“\”本身;
[[email protected] ~]# i=`echo "11,22,33,44"`
[[email protected] ~]# echo ${i%,*}
11,22,33 #从最后倒数到最短的匹配部分后面的逗号的地方被删除
[[email protected] ~]# echo ${i%%,*}
11 #从最后倒数到最长的匹配部分后面的逗号的地方都被删除
[[email protected] ~]# echo ${i#*,}
22,33,44 #从开头到最短的匹配部分后面的逗号的地方被删除
[[email protected] ~]# echo ${i##*,}
44 #从开头到最长的匹配部分后面的逗号的地方被删除
边栏推荐
猜你喜欢

Adding, deleting, checking and modifying dynamic sequence table with C language

Are you ready for the Internet of things to revolutionize manufacturing?

力扣刷题量300记录帖

Six ways for the Internet of things to improve our lives

ESP8266 STA_Server

ESP8266-----JSON----c函数库提供字符串函数

MakeFile

Software Foundation of software test interview questions
![[untitled]](/img/9e/ccb630a699846de3d99bb7407b2d44.jpg)
[untitled]

Esp8266---json---c function library provides string functions
随机推荐
ESP8266 AP_MODE
[untitled]
Adding, deleting, checking and modifying dynamic sequence table with C language
Cannot find a valid baseurl for repo: HDP-3.1-repo-1
Esp8266 access to cloud platform ----- DNS domain name connection server
7. Formula F1 champion
Unity常用的一些简易扩展方法
Software Foundation of software test interview questions
5. Xshell connection server denied access, password error
Data storage summary of C language
05 - attack and defense of phishing websites
Esp8266 connects to the IOT of Lexin cloud platform_ Demo
ESP8266 STA_ UDP_ Client
Pit encountered by AssetBundle
Unity ugui text text box adaptation
数学建模简介-从现实对象到数学建模[2]
十五、expect
Esp8266---json---c function library provides string functions
Six ways for the Internet of things to improve our lives
Come and help you understand the mobile Internet in a minute