Hi folks,
I manage to create the following script in php that's working.
The aim is to extract and use multiple parameters from a single {query}. Here's a simplified example:
$query = explode(' ', '{query}');
$elemA = $query[0];
$elemB = $query[1];
$elemC = $query[2];
echo "{$elemA}{$elemB}{$elemC}";
I would like to do the same in bash but cannot manage to get it work. Here's my try:
This one is working outside Alfred, directly for my Terminal.
Basically, it also automatically detect any space as a separator.
query="{query}"
i=1
for param in $query; do
case $i in
1) elemA=$param;;
2) elemB=$param;;
3) elemC=$param;;
esac
i=$[i+1]
done
echo "${elemA}${elemB}${elemC}"
From all my tries, I've not been able to enter the "for" loop statement… Would you have any idea?
Thanks in advance,
Cheers,
Édouard.