Archive for February, 2015

[Shell编程] shell脚本改变工作目录

2015.2 2

shell脚本运行的几种方式:
1:添加脚本的执行权限,然后通过路径加文件名的方式运行

chmod +x test.sh;./test.sh

2:source test.sh 或者 . test.sh

3: sh test.sh

后两种方式不必添加脚本的执行权限。怎么改变shell脚本运行的工作目录呢?请看例子:

[sunliguo@sun sgunicom…