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 [2019/05/03 23:54]
peternlewis [Quoting Strings]
action:Execute_a_Shell_Script [2019/07/09 04:28] (current)
peternlewis [Output of Results]
Line 1: Line 1:
-{{:​action:​shell-script-icon.png?​nolink|}} 
 ====== Execute a Shell Script ====== ====== Execute a Shell Script ======
  
Line 9: Line 8:
  
 {{:​action:​execute-shell-script.png?​nolink&​693|}} {{:​action:​execute-shell-script.png?​nolink&​693|}}
 +
 +If the script fails, the action will fail (v9.0+), potentially aborting the macro.
  
 ==== Using Keyboard Maestro Variables ==== ==== Using Keyboard Maestro Variables ====
Line 35: Line 36:
  
 See the [[#​Forum|Forum]] section below for more Python examples. See the [[#​Forum|Forum]] section below for more Python examples.
- 
---- 
  
 Note that you can only read these environment variables. ​ You cannot write to them (or more accurately, you can write to them but that will not change the Keyboard Maestro variables that they were created from). Note that you can only read these environment variables. ​ You cannot write to them (or more accurately, you can write to them but that will not change the Keyboard Maestro variables that they were created from).
Line 73: Line 72:
   * [[https://​forum.keyboardmaestro.com/​t/​png-metadata-comment/​6375/​29| How To Quote Paths by @ccstone]].   * [[https://​forum.keyboardmaestro.com/​t/​png-metadata-comment/​6375/​29| How To Quote Paths by @ccstone]].
   * [[https://​forum.keyboardmaestro.com/​t/​trouble-expanding-variable-in-shell-script/​13664/​2?​u=jmichaeltx | Trouble Expanding Variable in Shell Script by @PeterNLewis]]   * [[https://​forum.keyboardmaestro.com/​t/​trouble-expanding-variable-in-shell-script/​13664/​2?​u=jmichaeltx | Trouble Expanding Variable in Shell Script by @PeterNLewis]]
- 
---- 
  
 ==== UTF-8 and Non-ASCII Characters ==== ==== UTF-8 and Non-ASCII Characters ====
  
 If you are dealing with non-ASCII characters, you probably want to set the `LC_ALL` environment variable to UTF8, which you can do by setting the Keyboard Maestro variable `ENV_LC_ALL` to “en_US.UTF-8”. If you are dealing with non-ASCII characters, you probably want to set the `LC_ALL` environment variable to UTF8, which you can do by setting the Keyboard Maestro variable `ENV_LC_ALL` to “en_US.UTF-8”.
 +
 +By default (v9.0+), if you have not set these environment variables they will be set to UTF-8 for you.
  
 ==== Action Gear ==== ==== Action Gear ====
  
-The Action ​(gear) menu includes the following options:+The action ​(gear) ​⚙ menu includes the following options:
  
 * Trim Results — removes white space from the start and end of the scripts results. * Trim Results — removes white space from the start and end of the scripts results.
Line 99: Line 98:
   * Pasted in to the current selection.   * Pasted in to the current selection.
   * Saved to a variable.   * Saved to a variable.
 +  * Appended to a variable (v9.0+).
   * Saved to the system or a Named Clipboard.   * Saved to the system or a Named Clipboard.
   * Asynchronously ignored — the action runs while the macro continues on.   * Asynchronously ignored — the action runs while the macro continues on.
action/Execute_a_Shell_Script.1556942070.txt.gz · Last modified: 2019/05/03 23:54 by peternlewis