ShellCheck is installed by default on the
ubuntu-latest host in Azure Pipelines. To see all installed software, consult the Azure documentation.
Trying to run ShellCheck as usual within the pipeline will produce an error:
$ shellcheck myscripts/*.sh myscripts/*.sh: myscripts/*.sh: openBinaryFile: does not exist (No such file or directory)
The recommended approach is to use
find to search the files and pass a list of those to ShellCheck:
$ shellcheck $(find $(pwd)/myscripts/ -name "*.sh")
Copy the following YAML to run ShellCheck in Azure Pipelines against all
*.sh files in the current directory:
trigger: - master jobs: - job: shellcheck displayName: ShellCheck pool: vmImage: 'ubuntu-latest' steps: - script: shellcheck $(find $(pwd) -name "*.sh") displayName: 'Running ShellCheck'
ShellCheck is a static analysis tool for shell scripts. This page is part of its documentation.