## error bash exited with code ‘127’ azure pipeline

Error: bash exited with code ‘127’ in Azure Pipeline

When running a bash command or script in an Azure Pipeline, receiving an exit code of ‘127’ indicates that the command or script is not found or not executable.

This error can occur due to various reasons:

  1. The specified command or script is not available or installed on the agent machine.
  2. The execution permissions are not set correctly for the command or script.
  3. The command or script is misspelled or the wrong path is provided.

To resolve this error:

  1. Verify that the necessary command or script is installed on the agent machine or is available in the PATH.
  2. Ensure that the execution permissions are set correctly. For example, if running a script, you can use the chmod command to make it executable:
  3. chmod +x script.sh
  4. Double-check the spelling and the path of the command or script provided in the Azure Pipeline configuration.

Example:

steps:
  - script: |
      #!/bin/bash
      echo "Hello, world!"
    displayName: 'Run Bash Script'

In the above example, the ‘script’ task runs a bash script that simply prints “Hello, world!”. If you encounter the ‘bash exited with code ‘127” error, make sure that the necessary ‘bash’ executable is available on the agent machine and the script is executable.

Similar post

Leave a comment