1: #!/bin/ksh 2: 3: # Start the dndlookup program as a coprocess 4: # Tell it to output only the canonical full name, and to not print multiple matches 5: dndlookup -fname -u |& 6: 7: # move the input/output streams so we 8: # can use other coprocesses too 9: exec 4>&p 10: exec 5<&p 11: 12: cat namefile 13: 14: # read the names from a file "namefile" 15: while read uname; do 16: print -u4 $uname 17: read -u5 dndname 18: case $dndname in 19: *many\ matches*) 20: # handle case where the name wasn't unique 21: print "Multiple matches to \"$uname\" in DND" 22: ;; 23: *no\ match*) 24: # handle case where the name wasn't found 25: print "No matches to \"$uname\" in DND" 26: ;; 27: *) 28: # we seem to have a hit - process the 29: # canonical named retrieved from dndlookup 30: print "Unique DND match: full name for \"$uname\" is \"$dndname\"" 31: ;; 32: esac 33: done < namefile 34: 35: # We've read all the names, but the coprocess 36: # is still running. Close the pipe to tell it 37: # we have finished. 38: exec 4>&-
| last modified 09/02/2006 | Introduction | Table of Contents (frame/no frame) |
Printable (single file) |
© Dartmouth College |