Using the method from @cemeyer (https://github.com/espressif/esp-idf/pull/3166): find . -name \*.sh -exec sed -i "" -e 's|^#!.*bin/bash|#!/usr/bin/env bash|' {} + Closes https://github.com/espressif/esp-idf/pull/3166.