#!/bin/ksh
# File: mycp
# mycp will cp a file.  If destination exists, prompt for overwrite.

if [ $# -ne 2 ] ; then  # check for exactly two arguments
   echo "Usage: $0 source dest"
   exit 1
fi

if [ -f $2 ]; then
   echo "$2 already exists: overwrite? (y/n) \c"
   read a
   if [ "$a" = y ] ; then
      cp $1 $2   # overwrite dest
   fi
else
   cp $1 $2   # dest did not already exist, just do copy
fi
