xilopaint Posted August 31, 2017 Share Posted August 31, 2017 (edited) How can I use a environment variable in a Terminal Command object? I don't know how to print a environment variable. echo {query} works, echo $my_variable doesn't. Edited September 1, 2017 by xilopaint Link to comment
xilopaint Posted September 1, 2017 Author Share Posted September 1, 2017 @deanishe, could you give me a hand here? Link to comment
deanishe Posted September 1, 2017 Share Posted September 1, 2017 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. xilopaint 1 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now