Jump to content

Environment Variables in Terminal Command Object

Recommended Posts

You can't use a variable in a Terminal Command. The way Run Script and Script Filters work is that Alfred replaces {query} in the script you've entered, and then passes the script to whichever shell or interpreter you've specified (bash, zsh, Python etc.). Workflow variables are passed as environment variables to the interpreter process itself when Alfred runs it.

That can't work in a Terminal Command, as your script is executed in a shell run by Terminal or iTerm where your workflow variables don't exist, not one started by Alfred with your workflow's context. So all you get is the {query} text macro.


If you want to use variables in a Terminal Command, you'll have to use a Run Script action—where your variables do exist—to generate the script to be passed to Terminal/iTerm.


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