• Recent
    • Tags
    • Popular
    • Register
    • Login

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website

    Pass sentence as argument in Process Command

    User help
    2
    4
    2.0k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ricardoR
      ricardo
      last edited by

      I have a simple shell script (temp2.sh) as follow:

      $ cat temp2.sh
      #!/bin/bash
      echo "1=$1 2=$2" > /home/ricardo/test1.log

      If I run it in shell with the following arguments, here are the output:

      $ ./temp2.sh 'This is first sentence' 'This is 2nd sentence'
      $ cat /home/ricardo/test1.log
      1=This is first sentence 2=This is 2nd sentence

      However, if I trigger the same command in Process Command, the output is the following:
      $ cat /home/ricardo/test1.log
      1='This 2=is

      Any idea?

      BR,
      Ricardo

      1 Reply Last reply Reply Quote 0
      • phildunlapP
        phildunlap
        last edited by

        I haven't looked at the code for setting the arguments to the process command recently, but it looks from your results as though Mango were splitting the String at spaces before doing whatever magic invokes it.

        The easy workaround is to use something else as your space character, and preferably something with no other regex or shell meaning, and something you're happy enough not to have in your strings. (Consider '%20;' or whatever works)

        For instance,

        space="_";
        str="this_is_a_test_string";
        result=$(echo $str | sed s/$space/\ /g)
        echo result
        
        1 Reply Last reply Reply Quote 0
        • ricardoR
          ricardo
          last edited by

          Thank you for the workaround and I think it will be a good temporary solution.

          Please consider a permanent fix in the next coming release.

          BR,
          Ricardo

          1 Reply Last reply Reply Quote 0
          • First post
            Last post