学习目标:
- 一周掌握 shell编程
变量的高级用法
变量替换
##变量替换(贪婪,从前往后匹配,匹配到进行删除)
test1='I love you,you love me'
echo $test1
handletest1=${test1##*ov}
echo $handletest1
##变量替换(非贪婪,从前往后匹配,匹配到进行删除)
test2='I love you,you love me'
echo $test2
handletest2=${test2#*ov}
echo $handletest2
##变量替换(非贪婪,从后往前匹配,匹配到进行删除)
test3='I love you,you love me'
echo $test3
handletest2=${test3%ov*}
echo $handletest2##变量替换(贪婪,从后往前匹配,匹配到进行删除)
test3='I love you,you love me'
echo $test3
handletest2=${test3%%ov*}
echo $handletest2
handletest2=${test3/ov/ef}
handletest2=${test3//ov/ef}