字符串操作符语法:
替换操作符(:)
${varname:-word}, if count is not defined, ${count:-0} is 0
${varname:=word}, if count is not defined, ${count:=0} define count 0
${varname:?message}, if varnaem is defined, return varname, else print message
${varname:+word}, if varname is defined, return word, else return null
模式与模式匹配:
模式匹配操作符(#,##,%,%%)
${variable#pattern}, 取值的开头,删除最短匹配
${variable##pattern}, 取值的开头,删除最长匹配
${variable%pattern}, 取值的结尾,删除最短匹配
${variable%%pattern}, 取值的结尾,删除最长匹配
命令替换:
$(Unix command)
Subscribe to:
Post Comments (Atom)
1 comment:
Good for people to know.
Post a Comment