千家信息网

BASH - 参数扩展

发表于:2025-02-01 作者:千家信息网编辑
千家信息网最后更新 2025年02月01日,BASH - 参数扩展root@localhost:/root> echo "AA/BB/CC/DD" >> testfileroot@localhost:/root> cat testfileAA/
千家信息网最后更新 2025年02月01日BASH - 参数扩展

BASH - 参数扩展

root@localhost:/root> echo "AA/BB/CC/DD" >> testfile

root@localhost:/root> cat testfile

AA/BB/CC/DD

root@localhost:/root>

要求把后边DD替换掉

root@localhost:/root> TXT=`cat testfile` ; echo ${TXT%%DD}

AA/BB/CC/

root@localhost:/root>

Thinking:
http://www.linuxsir.org/bbs/forum60.html

0