如何使用bash移动到其他目录?

时间:2016-01-08 18:53:54

标签: linux bash shell

我的剧本

#!/bin/bash

for file in *.ats; do
mv $file /home/holmes/procmt
done

cd /home/holmes/procmt

所有文件都被移动但我想将当前目录更改为/ home / holmes / procmt并且没有任何反应.WHY? 如果我运行脚本./pch.sh,我会留在同一个shell中。

1 个答案:

答案 0 :(得分:0)

运行脚本的shell已移动,但您在启动脚本时输入的shell仍然存在。如果您在shell脚本的名称前加.(点空格),它将在'您的'中运行。外壳