脚本如下:
#!/bin/bash
#test $() and ${} and $(()) useges
#by:key1088@163.com
#mail:key1088@163.com
file=$(pwd)
echo $file
echo
echo '${file#*/}'
echo ${file#*/}
echo
echo '${file##*/}'
echo ${file##*/}
echo
echo '$(file%/*)'
echo ${file%%/*}
echo
echo '${file/cis7/cis8/}'
echo ${file/cis7/cis8/}
echo
echo '${file//cis7/cis8/}'
echo ${file//cis7/cis8/}
echo
echo '${file:0:5}'
echo ${file:0:5}
echo
echo '${file:5:5}'
echo ${file:5:5}
echo
echo '$(#file)'
echo $