Posted to tcl by Bradipo at Tue Dec 06 20:11:35 GMT 2016view pretty

#!/bin/sh
# \
exec tclsh "$0" ${1+"$@"}

proc gotit {fd} {
  if {[gets $fd line] <0} {
    return
  }
  puts stderr "PIPEREAD: $line"
}

set p [open /tmp/namedpipe r+]
fconfigure $p -blocking 0
fileevent $p readable "gotit $p"
vwait done