#!/bin/csh -f # cprel # ------------------------------------------------------------------------------ # Shell script to copy a file to the same relative location in a target # directory. Basically appends entire 1st arg to 2nd arg to determine # target location. Creates nested target directories as needed. # ------------------------------------------------------------------------------ # Usage: See Usage section below or run with no arguments to see usage. # Assumptions: # Effects: # - Copies a file and creates containing target dirs. # Notes: # Implementation Notes: # Portability Issues: # Revision History: # $Log$ # ------------------------------------------------------------------------------ set option = if ("$1" == "-i") then set option = "$1" shift endif if ($#argv < 2) then echo "Usage: $0:t [-i] source_filename target_dir_root" echo "Example: $0:t abc target abc --> target/abc" echo "Example: $0:t ./abc target ./abc --> target/./abc" echo "Example: $0:t ../abc target ../abc --> target/../abc" echo "Example: $0:t 1/2/3/abc target 1/2/3/abc --> target/1/2/3/abc" echo "Example: $0:t ~fred/abc target /Users/fred/abc --> /Users/fred/abc" exit 1 endif # Use :q instead of "" in case option is empty. Generates nothing instead of # an empty quoted string which would be counted as first arg. mdcp $option:q "$1" "$2/$1" set rc = $status #echo "$rc reported by mdcp" exit $rc