<menu id="sowow"><strong id="sowow"></strong></menu><menu id="sowow"><nav id="sowow"></nav></menu>
<menu id="sowow"></menu>
<menu id="sowow"></menu>
400-650-7353
ڵλã > IT؛Y > linux > LinuxA֪RshellַҊ

LinuxA֪RshellַҊ

  • Դ͘I
  • 2021-09-28 10:42:00
  • x()
  • ֙C

ַݽȡ

Ƚ

${׃:ʼλ:L}

lȡַ12345678905λ8λ

[root@host01 ~]# x="1234567890"

[root@host01 ~]# echo ${x:4:4}

5678

lȡַ12345678903λһλ

[root@host01 ~]# x="1234567890"

[root@host01 ~]# echo ${x:2}

34567890

[root@host01 ~]# x="1234567890"

[root@host01 ~]# echo ${#x}

10

[root@host01 ~]# echo ${x:2:${#x}}

34567890

ȡַ1234567890ǰ5λ

[root@host01 ~]# x="1234567890"

[root@host01 ~]# echo ${x:0:5}

12345

[root@host01 ~]# echo ${x::5}

12345

lȡַ“A񹲺͇”ĵ3λ4λ

[root@host01 ~]# x="A񹲺͇"

[root@host01 ~]# echo ${x:2:2}

҂Ƚ

${׃:0-ʼλ:L}

 ҂Ƚȡַ“A񹲺͇”҂ȵ3λһλ

[root@host01 ~]# x="A񹲺͇"

[root@host01 ~]# echo ${x:0-3}

͇

҂Ƚȡַ“A񹲺͇”҂ȵ3λ_ʼȡ2λ

[root@host01 ~]# x="A񹲺͇"

[root@host01 ~]# echo ${x:0-3:2}

ַ1234567890߅5λ_ʼȡ3λ

[root@host01 ~]# x="1234567890"

[root@host01 ~]# echo ${x:5:3}

678

ַQ

1. ֻQһƥY${׃/old/new}

ַ1234512345Ќһ3Qxxx

[root@backup ~]# i="1234512345"

[root@backup ~]# echo ${i/3/xxx}

12xxx4512345

2. QȫƥY${׃//old/new}

ַ1234512345Ќе3Qxxx

[root@backup ~]# i="1234512345"

[root@backup ~]# echo ${i//3/xxx}

12xxx4512xxx45

ַ1234512345Ќе3Qɿַ

[root@backup ~]# i="1234512345"

[root@backup ~]# echo ${i//3/}

12451245

ַ݄h

1. ƥh${׃#*PI~}

ַhttp://www.sina.com.cnЌð̖“:”߅ַȥ

[root@backup ~]# i="http://www.sina.com.cn"

[root@backup ~]# echo ${i#*:}

//www.sina.com.cn

ַhttp://www.sina.com.cnЌһ“.”߅ַȥ

[root@backup ~]# i="http://www.sina.com.cn"

[root@backup ~]# echo ${i#*.}

sina.com.cn

2. Lƥh${׃##*PI~}

ַhttp://www.sina.com.cnЌ“http://”߅ַȥ

[root@backup ~]# i="http://www.sina.com.cn"

[root@backup ~]# echo ${i##*\/}

www.sina.com.cn

ַhttp://www.sina.com.cnЌһ“.”߅ַȥ

[root@backup ~]# i="http://www.sina.com.cn"

[root@backup ~]# echo ${i##*.}

cn

ַhttp://www.sina.com.cnЌһ“w”߅ַȥ

[root@backup ~]# i="http://www.sina.com.cn"

[root@backup ~]# echo ${i##*w}

.sina.com.cn

3. ƥh${׃%PI~*}

ַhttp://www.sina.com.cnЌ߅һ“.”߅ַȥ

[root@backup ~]# i="http://www.sina.com.cn"

[root@backup ~]# echo ${i%.*}

http://www.sina.com

Ӌ㮔ǰűP“/”օ^ĴűPʹ

[root@backup ~]# df

Filesystem 1K-blocks Used Available Use% Mounted on

devtmpfs 487168 0 487168 0% /dev

tmpfs 497828 0 497828 0% /dev/shm

tmpfs 497828 7636 490192 2% /run

tmpfs 497828 0 497828 0% /sys/fs/cgroup

/dev/sda3 11523072 1674024 9849048 15% /

/dev/sda1 520868 156640 364228 31% /boot

tmpfs 99568 0 99568 0% /run/user/0

t֘R15%ȡxֵo׃i

[root@backup ~]# df|grep "/$"

/dev/sda3 11523072 1674100 9848972 15% /

[root@backup ~]# df|grep "/$"|awk '{print $5}'

15%

[root@backup ~]# i=$(df|grep "/$"|awk '{print $5}')

[root@backup ~]# echo $i

15%

ַ“15%”е“%”ȥ

[root@backup ~]# echo ${i%\%*}

15

4. Lƥh${׃%%PI~}

ַhttp://www.sina.com.cnЌ߅һ“.”߅ַȥ

[root@backup ~]# i="http://www.sina.com.cn"

[root@backup ~]# echo ${i%%.*}

http://www

ַ׃ʼֵ̎

ʹecho ${׃:-ֵ}ķʽݔ׃ֵ׃ھݔھݔO“ֵ”

׃xӡ׃xֵ;׃xڴӡOֵ

[root@host01 ~]# x="1234567890"

[root@host01 ~]# echo ${x:-abc}

1234567890

[root@host01 ~]# unset x

[root@host01 ~]# echo ${x:-abc}

abc

¡LinuxA֪RshellַҊю

>>ĵַhttp://www.52411888.com/zhuanye/2021/70185.html

THE END  

•:վй͘IδSɲDd

IȡAԌWITYԴ

ȺW·+ҕl̳+ĿԴa

漰JavaWebǰUIOӋܛyԇPythonȶITT

_΢һ߼IȡŶ~

1 g

2 ČWv

3 ĂĹ

@ȡyԇY
  • ǰǰ
  • 󔵓󔵓
  • “WIN“WIN
  • JavaJava
  • LinuxӋLinux
  • Python+˹Python
  • Ƕʽ“WǶʽ
  • ȫ\Iȫ\I
  • ܛyԇܛyԇ
  • ҃OӋ҃OӋ
  • ƽOӋƽOӋ
  • OӋ
  • WOӋWOӋ
  • ȫ·UI/UEOӋUIOӋ
  • VR/ARΑ_lVR/AR
  • WjȫWjȫ
  • ýwcҕl\Iýw
  • ֱ؛ֱ؛
  • ܙCܛ_lܙC
 

ͨfast track

_rgTIME

A片三十分钟试看,女性高爱潮A级视频免费,国产不卡一卡2卡三卡4卡网站
<menu id="sowow"><strong id="sowow"></strong></menu><menu id="sowow"><nav id="sowow"></nav></menu>
<menu id="sowow"></menu>
<menu id="sowow"></menu>