- 论坛徽章:
- 0
|
你的脚本,问题出在涉及到nohup的那些命令,这么给你解释:
Shell scripts are run inside a subshell, and each subshell has its own concept of what the current directory is. The cd succeeds, but as soon as the subshell exits, the previous current directory is restored.
给你举个例子:- [17:07:51-Bob@hzling08:~/test]-(1027)No.27->$ cat aa
- #!/bin/bash
- cd /home
- pwd
- [17:07:53-Bob@hzling08:~/test]-(1028)No.28->$ sh aa && pwd
- /home
- /home/xiabao/test
- [17:07:56-Bob@hzling08:~/test]-(1029)No.29->$ ./aa && pwd
- /home
- /home/xiabao/test
- [17:08:05-Bob@hzling08:~/test]-(1030)No.30->$ . ./aa && pwd
- /home
- /home
复制代码 所以,以后涉及到相对路径的问题,要慎重…… |
|