Jump to content

running a .sh (in place)

Recommended Posts

Can anyone suggest a way or sketch a workflow to be able to run shell scripts from alfred directly?





Say I have a example.sh in /home/folder/


I'd like to be able to run this from Alfred; i.e. the following sequence of events happen:


1. I type example.

2. example.sh shows up in the list of results.

3. I [hotkey] to the options menu of example.

4. I [hotkey] something (a workflow?) to execute the script (in /home/folder).

Edited by maillardduck

Share this post

Link to post

To find your scripts, your best bet is probably to set up a File Filter.
Then to run it, you can use (something like) the following script in a Run Script action: 

script_dir=$(dirname "${script_path}")
cd "${script_dir}"

Note: This script requires the executable bit to be set on the script you're trying to run.


You can connect your File Filter directly to the Run Script action and/or use a File Action.

Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...