对于一段包含cd 命令的shell脚本(test.sh):

#!/bin/bash
cd ..
mkdir ./test

运行:

sh ./test.sh

脚本运行时无法在上级目录建立test文件

此时用

. ./test.sh

即可

相关文章:

  • 2022-12-23
  • 2021-12-10
  • 2021-09-02
  • 2022-02-10
猜你喜欢
  • 2021-09-30
  • 2021-10-31
  • 2022-03-04
  • 2021-12-10
  • 2022-12-23
  • 2022-12-23
  • 2021-12-10
相关资源
相似解决方案