How to run bash script from Hammerspoon?

2,225 views
Skip to first unread message

Brad Parks

unread,
Dec 9, 2016, 9:21:07 AM12/9/16
to Hammerspoon
Hey! I'd like to be able to run an arbitrary bash script from Hammerspoon.

I tried using hs.application.launchOrFocus, but it didnt seem to work.

Any suggestions?

I can of course make something work I think by building an .app that accepts a string argument, but wanted to see if there's something in Hammerspoon to do it without going outside it's api.

Thanks,

Brad



Brad Parks

unread,
Dec 9, 2016, 9:44:54 AM12/9/16
to Hammerspoon
Ahh... found the answer - I can run an arbitrary shell script using the following:

  result = hs.applescript('do shell script "my shell script here"')

Thanks!

Brad

Peter van Dijk

unread,
Dec 9, 2016, 9:46:45 AM12/9/16
to Hammerspoon

Hello Brad,

that’s a bit of a roundabout way! I suggest looking at hs.execute and hs.task.

Peter

--
You received this message because you are subscribed to the Google Groups "Hammerspoon" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hammerspoon...@googlegroups.com.
To post to this group, send email to hamme...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/hammerspoon/a884d2f8-8dc2-427c-bcd4-2630e5c7e6c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Brad Parks

unread,
Dec 9, 2016, 9:49:57 AM12/9/16
to Hammerspoon
ahh... cool... thanks a bunch, I'll take a look

Brad
Reply all
Reply to author
Forward
0 new messages