我有以下2个文件:
文件cd2vcaa(在路径中):
#! /bin/bash
cd /var/cache/apt/archives
文件test.sh(在当前目录中):
#! /bin/bash
. cd2vcaa
在终端上,我可以使用. cd2vcaa
来更改目录,而不能使用./test.sh
来更改目录
~$ cd2vcaa <-- no effect
~$ . cd2vcaa <-- changes directory
/var/cache/apt/archives$ cd <-- back to home directory
~$ ./test.sh <-- does not change directory though no error - why?
~$
为什么. cd2vcaa
是在终端上运行但在另一个脚本内运行?
这个问题怎么解决?