【发布时间】:2017-05-15 07:08:16
【问题描述】:
我写了一个脚本来改变当前目录。
#!/bin/sh
cd userA/toWhere/
获取脚本后,它会更改当前目录,但我想使用 bash invocation 从子进程更改它。有可能吗?
【问题讨论】:
我写了一个脚本来改变当前目录。
#!/bin/sh
cd userA/toWhere/
获取脚本后,它会更改当前目录,但我想使用 bash invocation 从子进程更改它。有可能吗?
【问题讨论】:
不,
bash scriptname
打开一个子shell,并且该子shell中的任何目录更改都不会影响调用shell。采购是唯一的选择。
【讨论】: