How to run a shell script using Spotlight passing

2019-04-28 13:35发布

问题:

It was mentioned that we can execute a shell script using spotlight renaming it as "myscript.command" as described here. But is it possible to pass a parameter to the script when calling it from Spotlight?

For example:

Script myscript.command:

#!/bin/bash
echo "Parameter: " $1

On Spotlight:

myscript.command test

Output:

(...)
Parameter: test
(...)
[Process completed]