Hello, there.
I have a UserParameter that does a process substitution to feed stdin of while read. Command works fine running directly from bash, but from zabbix it outputs a error. I did a quick search and it seems that process substitution isn't posix compliant. Does anyone know best way to solve this problem?
UserParameter=key,/bin/echo -n '{"data":['; while read line; do /bin/echo -n "{"{#LLD_MACRO}": "$line"},"; done < <(cat some_file.txt | grep some_grep | awk '{ print $2 }') | sed -e 's:,$::'; /bin/echo -n ']}'
Error:
[t|sh: -c: line 0: syntax error near unexpected token `<'
Best regards
I have a UserParameter that does a process substitution to feed stdin of while read. Command works fine running directly from bash, but from zabbix it outputs a error. I did a quick search and it seems that process substitution isn't posix compliant. Does anyone know best way to solve this problem?
UserParameter=key,/bin/echo -n '{"data":['; while read line; do /bin/echo -n "{"{#LLD_MACRO}": "$line"},"; done < <(cat some_file.txt | grep some_grep | awk '{ print $2 }') | sed -e 's:,$::'; /bin/echo -n ']}'
Error:
[t|sh: -c: line 0: syntax error near unexpected token `<'
Best regards