Jump to content

simplest way to execute bash script


Recommended Posts

Hi all

 

Many of the apps I use are java or bash script apps, most of them them depend on a bash script to initiate.

Usually I make a workflow with "keyword to script" template but i'm guessing if there is a simpler method to do it.

 

I suppose Alfred scans App folder and let me fire any app (or script) found there but when I write the script name (even with .sh extension) or the full path to script, it opens in editor.

Using ">" to force it open in terminal gives me a "Short-Lived Session Warning" and terminal closes.

 

Surely I'm mistaken, but wich is the best an simplest method to launch a bash script from Alfred that resides on App folder?

 

thanks

Edited by jomaweb
Link to comment

If I understand you correctly you want to be able to open Alfred, type the name of a script (which is located somewhere on your computer), and hit enter and have Alfred run the script. Is that right?


 


Here is a workflow that uses a file filter to search only certain file types (currently it'll only accept .py, .sh and .scpt, but it's easy to modify) in a certain search scope (currently ~/Desktop, but again, that's easily modified). To use it you type "script" and then search for the script that you want to run. When you hit enter the chosen script is passed through to a shell script which runs it (in theory :P). This is just to get you started, and won't do everything you require. For example, it currently attempts to run any script passed to it with Python, Bash and osascript, so you'd need to add some if statements to make sure the right script gets run with the right language :-) I'm fairly new to all this myself, so excuse me if I've misunderstood something. That's my best guess, anyway :D


Edited by Subject22
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...