标签:启动 水平 dde bytes mask byte glob host lob
read的使用
功能:显示输入的字符
-p 输入提示文字
-n 输入字符长度限制
-t 输入限时
-s 隐藏输入内容
[root@XX ~]# read -p "hello" hello [root@XX ~]#
echo的使用
功能:显示字符,echo会将输入的字符串送往标准输出,输出的字符串间以空白字符隔开,并在最后加上换行号。
语法:echo [-neE]
选项:
-E 默认,不支持\解释功能,""变量会替换,弱引用;‘‘变量不会替换,强引用
-n 不自动换行
-e 启动\字符的解释功能,需要加上""或者‘‘
常用的转义字符如下:
\a 响铃
\b 退格(backspace)
\e 转义符
\c 不换行
\f 换页
\n 换行
\r 回车
\t 水平制表符
\v 垂直制表符
\ONNN 字节数以八进制数 NNN (1 至 3 位)表不
\xHH 字节数以十六进制数 HH (1 至 2 位)表不
例:
[root@XX ~]# echo -e ‘www.baidu.com\nwww.google.com‘ www.baidu.com www.google.com
[root@XX ~]# echo {1..10} 1 2 3 4 5 6 7 8 9 10 [root@XX ~]# echo {1..10..2} 1 3 5 7 9
当使用echo输出命令提花后的内容时,名利执行结果的格式可能会发生变化。
例:
[root@XX ~]# echo ifconfig ifconfig [root@XX ~]# echo `ifconfig` ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.11 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::20c:29ff:fec1:2778 prefixlen 64 scopeid 0x20<link> inet6 2a00:23c4:3d9d:d500:20c:29ff:fec1:2778 prefixlen 64 scopeid 0x0<global> inet6 fdaa:bbcc:ddee:0:20c:29ff:fec1:2778 prefixlen 64 scopeid 0x0<global> ether 00:0c:29:c1:27:78 txqueuelen 1000 (Ethernet) RX packets 41800 bytes 17961825 (17.1 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 5875 bytes 422845 (412.9 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255 ether 52:54:00:22:1b:7e txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 [root@XX ~]# echo "`ifconfig`" ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.11 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::20c:29ff:fec1:2778 prefixlen 64 scopeid 0x20<link> inet6 2a00:23c4:3d9d:d500:20c:29ff:fec1:2778 prefixlen 64 scopeid 0x0<global> inet6 fdaa:bbcc:ddee:0:20c:29ff:fec1:2778 prefixlen 64 scopeid 0x0<global> ether 00:0c:29:c1:27:78 txqueuelen 1000 (Ethernet) RX packets 41801 bytes 17961885 (17.1 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 5876 bytes 422905 (412.9 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255 ether 52:54:00:22:1b:7e txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
标签:启动 水平 dde bytes mask byte glob host lob
原文地址:https://www.cnblogs.com/liuxuinUK/p/11829559.html