In bash, when I execute the following:
`
$ping -t 4 127.0.0.1 | grep packets
`
I get the expected output of:
`
4 packets transmitted, 4 packets received, 0.0% packet loss
$
`
likewise, if I execute:
`
$grep packets <<< “ping -t 4 127.0.0.1
”
`
again, I get:
`
4 packets transmitted, 4 packets received, 0.0% packet loss
$
`
In the CB CLI, I get interesting behavior when trying the same commands using different variations of the “run” shell command (!):
trying to pipe in commandBox’ built in ‘grep’ command:
`
CommandBox:esb> !ping -t 4 127.0.0.1 | grep “packets”
PING 127.0.0.1 (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.082 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.139 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.078 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.085 ms
— 127.0.0.1 ping statistics —
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.078/0.096/0.139/0.025 ms
CommandBox:esb>
`
piping in the shell’s “grep” (using run):
`
CommandBox:esb> !ping -t 4 127.0.0.1 | !grep “packets”
PING 127.0.0.1 (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.091 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.145 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.124 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.064 ms
— 127.0.0.1 ping statistics —
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.064/0.106/0.145/0.031 ms
bash: syntax error near unexpected token `&&’
ERROR (3.8.0+00766)
Command returned failing exit code [2]
CommandBox:esb>
`
(Where is the unexpected token `&&’ error coming from?)
and attempting the alternate, "grep packets <<< “!ping -t 4 127.0.0.1
"”
from inside commandBox gives similar results. I can’t seem to pass any external commands (executed using “run”) using stdIn to builtin or external shell commands from the commandBox shell.
Here, I’m using ‘ping’ as an example as it’s easy to reproduce, but any command that returns multiple lines to stdout shows the same behavior for me in commandBox.
Is this a known limitation of the shell or am I doing this wrong?
I’m running terminal on MacOS Sierra 10.12.6 and I’m running CommandBox 3.8.0+00766 and CLI Loader 1.5.5 (output of “ver” command)
Thanks in advance!
–Joel