Does KM access the user's .bash_profile when running Execute Shell?

This is not necessarily a great solution.

While it may work for specific cases, the idea of interactive mode is that you set up a bunch of things appropriate to you using it manually, things like syntax coloring and styling options, and reporting extraneous information, etc, that are unlikely to helpful and may be actively harmful to scripted execution which is why it is not enabled by bash by default when run as a script.

As described in the Execute a Shell Script action, you can set the global Keyboard Maestro variable ENV_PATH if you want to include specific paths, but in reality you are likely better off being specific about the path of your script, and if the path is necessary to the proper running of the script, to include it in the script.

Otherwise you will likely one day make some incidental change to your .bash_profile (eg to report free disk space) and find your macros stop working.

1 Like