Jump to content

Tazintosh

Member
  • Posts

    7
  • Joined

  • Last visited

Everything posted by Tazintosh

  1. You just made my day! Thanks for the support David!
  2. Thanks for your support David, but I still don't get how I could — with your example — build the following example of echo: How can I choose a specific parameter and use it multiple times, at different places on my echoed string? • query = "John 192.168.1.25 johndoe" (without quotes) • echo: "Hello John, your IP is 192.168.1.25 and your login is johndoe. Remember to use the IP 192.168.1.25 as DHCP with fixed IP and respect the case for johndoe. See you soon John!" Thanks
  3. So, if my query contains 3 elements, how do I echo them? My tries with "Hello $element[0], your IP is $element[1] and your login is $element[2]" are not working
  4. Thanks for your help David, but I'm afraid I'm not following you. I'm not dealing with files at all. What I'm trying to do is to extract multiple parameters from one query. Basic and stupid example with the following query: • query = "John 192.168.1.25 johndoe" (without quotes) • We can see that the query is three group of word, space separated (these are my 3 parameters). • My echo would be: "Hello John, your IP is 192.168.1.25 and your login is johndoe" Hope that's help. Thanks!
  5. 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.
×
×
  • Create New...