@deanishe
AH! I totally understand now and got it to work. I manipulated the script to detect if the argument has a space, then splits it. Thank you so much for your patience and help.
#!/bin/bash
if [ "$#" -eq 1 ]
then
open https://www.google.com
else
open https://www.apple.com
fi
Here's the example script if you care to try. The script I'm trying to launch exists in a directory and relies on data outside of the script. I suppose I could just refactor the script inside alfred, but ideally, I'd like to be able to launch the script in my directory straight from alfred.
@deanishe
Hm, okay I'll post it if I can figure it out. (only letting met attach photo types? I'll post a copy with a test case lest I share sensitive info.
I guess I assumed that the second param that I indicate after the space didn't work since when I use ./script param1 param2 it works fine, but when I try to execute from.
@vitor
Thanks for the suggestion. I just created my account and didn't realize that my handle was my email.
Perhaps I'm doing this wrong, but it still doesn't seem to work the way I want it.
Desired result:
type in wf {parameter1} {parameter2} > execute script with both parameters passed
Actual result:
Script fails out if 2 params are typed
Script does execute properly if I only require 1 parameter
I suppose what I need for Alfred to understand is I want both parameters to be passed as a single parameter into the script since bash interprets the command as two since it delimits by spaces. (i.e. "{param1} {param2}"). Alfred seems to interpret the spaces as delimiters as well and only passes {param1} into the script.
I hope I'm making sense
Hello,
I'm running a shell script that accepts either 1 or 2 parameters. It works with one parameter, but when I type in a second parameter after my keyword, it fails out. How do I get it to allow the second parameter?