如何使用Spotlight传递参数来运行Shell脚本? [英] How to run a shell script using Spotlight passing a parameter?

查看:109
本文介绍了如何使用Spotlight传递参数来运行Shell脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人提到,我们可以使用Spotlight将其重命名为"myscript.command"来执行shell脚本.如此处所述.但是,从Spotlight调用脚本时是否可以将参数传递给脚本?

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?

例如:

脚本myscript.command:

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

在Spotlight上:

On Spotlight:

myscript.command test

输出:

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

推荐答案

否,当前似乎无法实现.

No, it does not seem to be possible currently.

这篇关于如何使用Spotlight传递参数来运行Shell脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆