shell 获取当前目录名
basename `pwd`
echo ${PWD##*/}
parameter substitution with the ${var##pattern} syntax, which removes from $var the longest part of $Pattern that matches the front end of $var
pwd | rev | awk –F \/ '{print $1}' | rev
The -F option indicates that you should separate by fields, where the field delimiter is /, and that you should print field 1.
pwd | sed 's,^\(.*/\)\?\([^/]*\),\2,'