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.
Pass sentence as argument in Process Command
-
I have a simple shell script (temp2.sh) as follow:
$ cat temp2.sh
#!/bin/bash
echo "1=$1 2=$2" > /home/ricardo/test1.logIf 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 sentenceHowever, if I trigger the same command in Process Command, the output is the following:
$ cat /home/ricardo/test1.log
1='This 2=isAny idea?
BR,
Ricardo -
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
-
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