QA Graphic

Execute Shell Script

One of the nice things about https://www.keyboardmaestro.com/main/ is the ability to run Shell Scripts as part of a Macro action. This is useful when you want to apply a clipboard text to a shell script or just to execute a shell command.

Recently I wanted to set up a Status Menu action to simply run a shell script. I am doing some automation work and frequently need to test code changes. it's just easier to have a status menu than to open up a terminal and execute the run command.

Simple Setup

To execute commands, simply use the Bash Shell:

.

Keyboard Maestro Shell Script

Some Notes about Shell Execution

  • You can ignore the output results. (nice feature if you don't need to see the debug information)
  • I have an ampersand after the run_automation.sh so the command would run in the background. There is the ability to run the command asynchronously in Keyboard Maestro.
  • In my execution script, the directory where it's being executed from makes a difference, so I needed to change directory before running the command. I didn't use the 'Script File' method.
  • To run PHP commands you would type in: #!/usr/bin/php

Oh, more thing, if I want to run the command frequently, I can instantly change the macro to be included in the Global Macro Palette. It's a simple switch of the trigger type.

There's a lot of options available, including the ability to pass variables to the shell command. The Keyboard Maestro help section has a lot of detailed information on setting those up.

 

Comments

Add Comments

Name:
Comment:

 

About

These posts highlights some cool examples of why Keyboard Maestro should be part of every Mac OS user's computer. Keyboard Maestro is a powerful automation tool that can help improve productivity, save time, and streamline tedious tasks. It has a wide range of features and functions that can be customized to suit any user's needs, making it an ideal choice for Mac OS users.

Schedule

ThursdayPython
FridayMacintosh
SaturdayInternet Tools
SundayOpen Topic
Monday Media Monday
TuesdayQA
WednesdaySnagIt for QA