$符号的特殊用法..
截断:
input: var=”abcde”;echo ${var%d*}
output: abc
替换
input:
STRING=”This is a string”;echo ${STRING// /};echo ${STRING/ /}
output:
This_is_a_string
This_is a string
默认:
input: default=”hello”; unset var; echo ${var:-$default}
output: hello
完全的见http://tiswww.case.edu/php/chet/bash/bashref.html#SEC32
在bash中的一些快捷键:
ctrl+w: 删除一个单词
ctrl+u: 从光标所在位置删除到行的开始
ctrl+a: 移动光标到行首
ctrl+e: 移动光标到行末
推荐http://samrowe.com/wordpress/advancing-in-the-bash-shell/