pwd
后,现在一切正常无法弄清楚这里出了什么问题,但遇到了一个奇怪的问题。基本上脚本中的一些命令有效,而有些则无效。该脚本在 Jenkins 上运行。这是我的脚本的一部分 -
#!/bin/bash
set -x
echo -e "\n\n\n[$(basename "$0")] PWD: $PWD"
if [[ -z $SOME_VAR ]]; then
echo -e "\n[$(basename "$0")] Removing the folder..."
rm -rf folderToRemove # ❌ The folder is not removed even when control comes into this branch ❌
fi
# Update submodules
echo -e "\n[$(basename "$0")] Recursively updating submodules..."
git submodule update --init --recursive --jobs 5 --progress # ❌ Cannot see the output from this line. The command also doesn't seem to work/run, as the submodules are not updated to latest ❌
...
...
...
echo -e "\n[$(basename "$0")] wf-react status - "
git submodule status --recursive # ❌ Cannot see the output from this line ❌
echo -e "[$(basename "$0")] complete"
set +x
当我运行上面的脚本时,我可以看到 echo
命令的输出,但是像 rm -rf...
或 git ...
这样的重要命令似乎根本没有运行。在上面的代码中添加了带有 ❌
的注释。
知道为什么有些命令不起作用而有些命令起作用吗?任何帮助是极大的赞赏。如果您需要更多信息,请告诉我。