Posted to tcl by Bradipo at Fri Apr 19 20:43:26 GMT 2024view raw

  1. #!/bin/sh
  2. # \
  3. exec tclsh "$0" ${1+"$@"}
  4.  
  5. set fd [open /tmp/random.txt rb]
  6. puts stderr $fd
  7. fconfigure stdout -translation crlf
  8. fcopy $fd stdout
  9. catch {close $fd}
  10.  
  11. # tcpserver output
  12. tcpserver: status: 1/40
  13. tcpserver: pid 1645 from 127.0.0.1
  14. tcpserver: ok 1645 localhost:127.0.0.1:12345 localhost:127.0.0.1:dnawew9xhief6mgaig5y:40489
  15. file3
  16. error writing "sock1": invalid argument
  17. while executing
  18. "fcopy $fd stdout"
  19. (file "/tmp/random.tcl" line 8)
  20. tcpserver: end 1645 status 256
  21. tcpserver: status: 0/40
  22.  
  23. # tcpclient
  24. $ tcpclient -v 127.0.0.1 12345 /bin/sh -c 'cat <&6' > /tmp/random.fcopy
  25. tcpclient: connected to 127.0.0.1 port 12345
  26.