Interactive uucp - kuucp

   

Korn Shell: Unix and Linux Programming Manual, Third Edition, The
By Anatole Olczak

Table of Contents
Appendix D.  Sample Korn Shell Scripts


Interactive uucp - kuucp

Here is an interactive version of the uucp command. Instead of looking for a system name in the uucp systems file using grep, the remote system name is verified by using file I/O substitution and Korn shell patterns.

 #!/bin/ksh  #  #     kuucp - Korn shell interactive uucp  #  # Check usage  if (($# > 0))  then        print "Usage: $0"        exit 1  fi  # Set variables  PUBDIR=${PUBDIR:-/usr/spool/uucpublic}  # This sets UUSYS to the contents of the HDB-UUCP  # Systems file. It may be different on your system.  UUSYS=$(</usr/lib/uucp/Systems)  # Get source file  read SOURCE?"Enter source file: "  # Check source file  if [[ ! -f $SOURCE ]]  then        print "$SOURCE: non-existent or not accessible"        exit 2  fi  # Get remote system name  read RSYS?"Enter remote system name: "  # Check remote system name. It looks for a pattern  # match on the system name in the UUSYS file  #  # For the Bourne shell or older versions  # of Korn shell, this could be given as:  #     if [[ $(grep ^$RSYS $UUSYS) != "" ]]  if [[ $UUSYS != *$RSYS* ]]  then        print "$RSYS: Invalid system name"        exit 2  fi  print "Copying $SOURCE to $RSYS!$PUBDIR/$SOURCE"  uucp $SOURCE $RSYS!$PUBDIR/$SOURCE 

       
    Top
     



    Korn Shell. Unix and Linux Programming Manual, Third Edition
    Korn Shell. Unix and Linux Programming Manual, Third Edition
    ISBN: N/A
    EAN: N/A
    Year: 2000
    Pages: 177

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net