How to run a shell script using Spotlight?

后端 未结 3 649
臣服心动
臣服心动 2021-01-31 02:41

Is there a way to run a shell script using Spotlight on Mac OS X 10.6? I would like to be able to invoke a shell script directly from Spotlight without opening up a terminal.

相关标签:
3条回答
  • 2021-01-31 03:12

    I would also like to add, if you need the terminal window to disappear after running the command, you can set the terminal settings to do just that.

    It's under settings >> shell >> when the shell exits.

    This will still leave Terminal running but the script will at least clean up after itself.

    I used this for writing a script to hide and show desktop icons.

    0 讨论(0)
  • 2021-01-31 03:21

    Save your shell script with a .command suffix - this makes it double-clickable and you should also be able to run it directly from Spotlight too.

    0 讨论(0)
  • 2021-01-31 03:23

    To make the Terminal window disappear when finished as of MacOS >= 10.0:

    Terminal > Preferences > Select your default profile

    Then Shell > When the shell exits select Close if the shell exited cleanly

    0 讨论(0)
提交回复
热议问题