Submitted for your review, comment, and revision, a major update to this Wiki section:
###Path in Shell Scripts in the Execute Shell Script Action article.
- First, my sincere thanks to @peternlewis, @Tom, and @ccstone for their review and changes to my initial draft.
- In particular, @Tom identified the need to update this, and provided some great suggestions, long ago.
- This is actually a new section in this article.
- Paths in Shell Scripts are often misunderstood. We have had numerous topics/questions posted concerning this.
- So, if you can, please try to review this from the eyes of a user who may have limited experience in shell scripts.
- Finally, you should know I am a total novice at shell scripts. So I am totally relying on you guys to make sure all of this is technically correct, and is clear.
- ADDed a new section named “Path in Shell Scripts”
- Clearly show the default path
- Show how to set a path
- Show how to use the KM Var “ENV_PATH”
This paragraph now seems redundant to me. I propose it be removed:
FIXME: [@JMichaelTX: I propose to remove the below paragraph since the system path is now provided above.]
The default PATH for the system will generally be /usr/bin:/bin:/usr/sbin:/sbin - that is the script will search for tools in the /usr/bin directory, then in the /bin directory, then /usr/sbin and finally /sbin. Only tools installed by the system will be in these directories - any tools you have installed will almost certainly be elsewhere and so not found unless you either configure the PATH environment variable within Keyboard Maestro (by setting the ENV_PATH Keyboard Maestro variable or explicitly setting the PATH environment variable within each Execute Shell Script action) or use the full path of the command (eg, /usr/local/bin/exiftool).
- Use of “ENV_PERL5LIB” is still not clear to me. Please fix:
If your tool requires other environment variables to be set you can set them as well by creating an appropriate Keyboard Maestro variable with ENV_ at the front.
For example, if you want to use Perl in a Execute Shell Script, you can also create a Keyboard Maestro Variable ENV_PERL5LIB that will FIXME [which? use OR be set to] the PERL5LIB environment variable for each Execute Shell Script.
FIXME [@JMichaelTX: This is still unclear to me. Does the ENV_PERL5LIB variable need to be set explicitly to a path? OR, does it somehow get the path from the PERL5LIB environment variable?]