Shell 字符串操作
赋值
astr="Hello World"
bstr=Hello
substring
echo $astr
echo ${astr:6}
echo ${astr:0:6}
replace
echo ${astr/s1/s2} # ReplaceFirst
echo ${astr//s1/s2} # ReplaceAll
contact
cstr="$astr+$bstr"
赋值
astr="Hello World"
bstr=Hello
substring
echo $astr
echo ${astr:6}
echo ${astr:0:6}
replace
echo ${astr/s1/s2} # ReplaceFirst
echo ${astr//s1/s2} # ReplaceAll
contact
cstr="$astr+$bstr"