[zeromq-dev] Bash Binding

Evan Gates evan.gates at gmail.com
Sat Nov 23 01:26:14 CET 2013


I came across the Bash Binding here http://zeromq.org/bindings:bash

zmq_push () { m=$(cat) && echo \
    -e $(printf '\\x01\\x00\\x%02x\\x00%s' \
    $((1 + ${#m})) "$m") | nc -q1 $@; }

and I was slightly horrified. Awesome idea, scary implementation. It
can't handle null bytes, messages over 254 bytes, and uses a non
standard tool (nc). So I decided to spruce it up a bit for fun.

I looked into creating a complete ZMQ implementation but bash doesn't
support listening sockets yet.

https://bitbucket.org/emg/tidbits/src/bd9a73ffee30ecb220e7f7763bec342ecd3bf315/zmq/zmq.bash?at=master

Enjoy!

-Evan



More information about the zeromq-dev mailing list