I am trying to understand how a shell script is working. The tutorial states that the script should be run as the following way:

source oe-init-build-env rpi-build

Usually when doing this kind of research I would do sh -x oe-init-build-env rpi-build. However this approach wouldn't be the optimal one here because it would run the script in a new shell.

Is there a way to run a script with source and pass it the sh flags?


Just add a set -x in the script you are sourcing. You can end that by adding set +x in the script, to e.g. limit the output of your debug work.

source <(echo "set -x"; echo "set -- rpi-build"; cat oe-init-build-env; echo "set +x")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.