- ${varname:-word}
- echo ${count:-0} : prints '0' if count is null.
- ${varname:=word}
- echo ${count:=0} : prints '0' and assign 0 to count if count is null.
- ${varname:?message}
- echo ${count:?NULL} : prints 'bash: count: NULL' if count is null.
- ${varname:+word}
- echo ${count:+0} : prints '0' if count it NOT null.
- ${varname:offset:length}
- ehco ${var1:1:2} : prints 'am'.
- ${varname#pattern}
- echo ${PWD} is '/home/wonkim'.
- echo ${PWD#*/} is 'home/wonkim'.
- ${varname##pattern}
- echo ${PWD##*/} is 'wonkim'.
- ${varname%pattern}
- echo {PWD%/*} is '/home'.
- ${varname%%pattern}
- ${varname/pattern/string}
- echo {PWD/\//:} is ':home/wk157575'
- ${varname//pattern/string}
- ehco {PWD//\//:} is ':home:wk157575'
Refer 'page 91' and 'pag 96' of
Learning the bash
댓글 없음:
댓글 쓰기