当前位置: 技术问答>linux和unix
一段bash脚本
来源: 互联网 发布时间:2016-08-12
本文导语: 今天看脚本,遇到了这么一行,搜索引擎也不知道搜什么关键字,所以上来问问 log_stack=${log_stack#*:} 现行谢过了 | 删除变量log_stack中第一个":"左侧(含冒号)的字符 Shell Parameter Expansion: ${pa...
今天看脚本,遇到了这么一行,搜索引擎也不知道搜什么关键字,所以上来问问
log_stack=${log_stack#*:}
现行谢过了
log_stack=${log_stack#*:}
现行谢过了
|
删除变量log_stack中第一个":"左侧(含冒号)的字符
Shell Parameter Expansion:
${parameter#word}
${parameter##word}
The word is expanded to produce a pattern just as in filename expansion (see
Section 3.5.8 [Filename Expansion], page 22). If the pattern matches the beginning
of the expanded value of parameter, then the result of the expansion is
the expanded value of parameter with the shortest matching pattern (the ‘#’
case) or the longest matching pattern (the ‘##’ case) deleted. If parameter is ‘@’
or ‘*’, the pattern removal operation is applied to each positional parameter in
turn, and the expansion is the resultant list. If parameter is an array variable
subscripted with ‘@’ or ‘*’, the pattern removal operation is applied to each
member of the array in turn, and the expansion is the resultant list.
Shell Parameter Expansion:
${parameter#word}
${parameter##word}
The word is expanded to produce a pattern just as in filename expansion (see
Section 3.5.8 [Filename Expansion], page 22). If the pattern matches the beginning
of the expanded value of parameter, then the result of the expansion is
the expanded value of parameter with the shortest matching pattern (the ‘#’
case) or the longest matching pattern (the ‘##’ case) deleted. If parameter is ‘@’
or ‘*’, the pattern removal operation is applied to each positional parameter in
turn, and the expansion is the resultant list. If parameter is an array variable
subscripted with ‘@’ or ‘*’, the pattern removal operation is applied to each
member of the array in turn, and the expansion is the resultant list.
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。