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?

 

 

Example:

 

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
Link to comment

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_path="{query}"
script_dir=$(dirname "${script_path}")
cd "${script_dir}"
"${script_path}"

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.

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...