Jump to content

how to call terminal command from workflow

Recommended Posts

I was playing to call a terminal command from keyword


First, Add Templates -> Essentials -> Keywords to Terminal Command


Then, Added the keyword


Pasted below script to Terminal commnand

find $HOME/.Trash -not -path $HOME/.Trash -exec rm -rf {} \; 2>/dev/null 

When I type the keyword in alfred, press Enter/Return, nothings


What am I doing wrong?


Thanks for providing support and helps



Link to comment

I saw some 404's, so I updated the link here.


Just create a keyword trigger; then put in a script action that uses bash, then just paste that in there.


Make sure that when you use the keyword trigger (not a script filter), that you select "no argument." Otherwise, it will do something waiting for an argument.


Doublecheck the bash syntax by opening it in a terminal.


The other possible problem that you might be running into is a permissions one. Make sure that your regular user can execute that command. Otherwise, put a sudo in front of it. If you want to make sure you don't need a password, then add a line to your sudoers file that lets you execute that command passwordless.


If you need more, then download this workflow (https://github.com/shawnrice/alfred2-dhcp-toggle/blob/master/workflows/dhcp-toggle.alfredworkflow?raw=true) and see how it works.



Edited by Shawn Rice
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...