linux shell 获取执行脚本文件所在的目录 #!/usr/bin/env sh#get script file dirgetsd() {oldwd=`pwd`rw=`dirname $0`cd $rwsw=`pwd`cd $oldwdecho $sw}echo `getsd`