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