#의 첫 번째 항목을 '삭제'하려는 경우 ${parameter/pattern}
을 사용하십시오.
${parameter/pattern/string}
Pattern substitution. The pattern is expanded to produce a pat-
tern just as in pathname expansion. Parameter is expanded and
the longest match of pattern against its value is replaced with
string. If pattern begins with /, all matches of pattern are
replaced with string. Normally only the first match is
replaced. If pattern begins with #, it must match at the begin-
ning of the expanded value of parameter.
- 경기는 경로 확장을 사용하여 수행됩니다 (
?
및 *
생각).
- 패턴의 시작 부분에있는
#
은 특별한 의미가 있습니다. 따라서이 패턴을 \
으로 바꿉니다. 그리고 시퀀스 \#
은 패턴 시작 부분에 #
의 특별한 의미없이 리터럴 #
과 일치합니다.
예
VERSION=0.11.3-issue#18.6a0b43d.123
echo ${VERSION/\#/}
출력
0.11.3-issue18.6a0b43d.123
난 그냥 제거 할
출처
2016-08-25 12:07:19
vds
/# 문자를 대체 – uloco