Can I trigger a Shortcut from bash in macOS Monterey?

Solution 1:

According to the official documentation, if you have a shortcut named "Focus", you can simply trigger it by running

shortcuts run Focus

I just tested it successfully on macOS Monterey 12.0.1 (that's zsh but bash should be no different).

Solution 2:

There is a shortcuts shell command, which executes shortcuts. See man shortcuts for details:

NAME
     shortcuts – Command-line utility for running shortcuts.

SYNOPSIS
     shortcuts run shortcut-name [--input-path input-path ...] [--output-path output-path ...] [--output-type output-type]
     shortcuts list [--folder-name folder-name] [--folders]
     shortcuts view shortcut-name
     shortcuts sign [--mode mode] --input input --output output

DESCRIPTION
     The shortcuts command is used to run, list, view or sign shortcuts. To create or edit a shortcut, use the Shortcuts application.