#!/usr/bin/awk -f BEGIN { listener = "/inet/tcp/300/0/0" server = "/inet/tcp/0/127.0.0.1/400" quit = "no" print "" |& server print " getcredentials" |& server print " 300" |& server print " "ARGV[1]"" |& server print "" |& server while (match(quit,"no") && (listener |& getline) > 0) { if (match($0,"CREDOKBYYOU?")) { print "CREDOKBYME" |& listener quit="yes" } } close(listener) while (server |& getline) { print $0 } }