2021年2月1日星期一

bash - not running some commands while running others?

Unable to figure out what's wrong here, but ran into a weird issue. Basically some commands in the script work and some don't. The script is run on Jenkins. Here is part of my script -

#!/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 ❌  ...  ...  ...  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  

When I run the above script, I can see the output from echo commands, but the important commands like rm -rf... or git ... don't seem to run at all. Added comments with in the code above.

Any idea why some commands are not working and some are working? Any help is greatly appreciated. Let me know if you need more information please.

https://stackoverflow.com/questions/66003115/bash-not-running-some-commands-while-running-others February 02, 2021 at 11:06AM

没有评论:

发表评论