留在目录bash脚本的结束后改变 [英] Stay in directory changed after ending of bash script
本文介绍了留在目录bash脚本的结束后改变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的bash脚本:
#!/bin/bash
cd /tmp
运行我的脚本之前:
Before running my script:
pwd: /
运行我的脚本后:
After running my script:
pwd: /
运行过程中出现我的剧本低谷采购后,它:
After runnig my script trough sourcing it:
pwd: /tmp
我怎么能留在从脚本的路径没有采购呢?
How I can stay at the path from the script without sourcing it ?
推荐答案
您不能。改变当前目录只影响当前进程。
You can't. Changes to the current directory only affect the current process.
这篇关于留在目录bash脚本的结束后改变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文