User Tools

Site Tools


action:Execute_a_Shell_Script

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
action:Execute_a_Shell_Script [2023/09/22 04:39]
peternlewis [Quoting Strings]
action:Execute_a_Shell_Script [2024/11/19 03:38] (current)
peternlewis
Line 7: Line 7:
 * It is best to always specify the language using the `#!` at the front of the script. * It is best to always specify the language using the `#!` at the front of the script.
 * The script is executed with the `sh` shell, so if you want to use another language, or use any special kinds of shell-specific syntax, then you should specify the language. * The script is executed with the `sh` shell, so if you want to use another language, or use any special kinds of shell-specific syntax, then you should specify the language.
 +* The shell is a non-login shell, so configuration files (like .bashrc) will not be run - in particular, this means you will not have much in the PATH (see [[#​Path_in_Shell_Scripts|below]] for more information).
 * For more details and examples, see [[https://​forum.keyboardmaestro.com/​t/​impact-of-macos-catalina-defaulting-to-unix-shell-using-zsh/​15503/​12?​u=jmichaeltx|How to Use Shebang at Top of Shell Script]] * For more details and examples, see [[https://​forum.keyboardmaestro.com/​t/​impact-of-macos-catalina-defaulting-to-unix-shell-using-zsh/​15503/​12?​u=jmichaeltx|How to Use Shebang at Top of Shell Script]]
  
Line 249: Line 250:
  
 For example, if you want to use [[https://​www.perl.org/​ | Perl]] with a custom library search path in the Execute a Shell Script action, you can also create a Keyboard Maestro variable `ENV_PERL5LIB` that will set the [[http://​perldoc.perl.org/​perlrun.html#​ENVIRONMENT|PERL5LIB environment variable]]. For example, if you want to use [[https://​www.perl.org/​ | Perl]] with a custom library search path in the Execute a Shell Script action, you can also create a Keyboard Maestro variable `ENV_PERL5LIB` that will set the [[http://​perldoc.perl.org/​perlrun.html#​ENVIRONMENT|PERL5LIB environment variable]].
 +
 +(!) Note that if in the action you exclude the ENV_ variables (including potentially the ENV_PATH) from being included in the environment (eg by selecting //Include No Variables//​),​ this will result it them not being included and thus not setting the corresponding environment variables.
  
 ===== Working Directory ===== ===== Working Directory =====
action/Execute_a_Shell_Script.1695371968.txt.gz ยท Last modified: 2023/09/22 04:39 by peternlewis