linux shell 编程中 read i y=${i%%,*} echo "$y" 输出是变量i的值。 问下。后面的%%,*有什么用?

见:https://zhidao.baidu.com/question/348625350.html

---------------------------------------------------------------------------------------------

bruce@bruce-Lenovo-IdeaPad-V450:~$ i="abc,def,ghi,jlk"

bruce@bruce-Lenovo-IdeaPad-V450:~$ echo ${i%%,*}
abc
bruce@bruce-Lenovo-IdeaPad-V450:~$ echo ${i%,*}
abc,def,ghi
bruce@bruce-Lenovo-IdeaPad-V450:~$ echo ${i##*,}
jlk
bruce@bruce-Lenovo-IdeaPad-V450:~$ echo ${i#*,}
def,ghi,jlk
bruce@bruce-Lenovo-IdeaPad-V450:~$

你可能感兴趣的:(linux,shell)