来源: http://syre.blogbus.com/logs/49837548.html
在很深的目录里的时候, 要往上跳n级, 就要敲很多键盘。 可以用如下脚本快捷实现, 加在.bashrc里
up(){ i=$1 if [ -z $i ]; then i=1 fi p='' while (($i>0)); do p="../$p" (( i-- )) done cd $p }
用法: up [levels]。 比如 up 2 就会向上跳两级目录。 不加参数, 就往上一级, 相当于 cd .. 。