#!/bin/sh # list directories in path $1 f_dls () { ls -l $1|egrep "^d"|awk '{print $9}' } ifdir="/etc/pf" ifs=$(f_dls $ifdir) echo "Enter name of source interface:" echo "$ifs" echo -n ">" read if_src echo "Enter name of destination interface:" echo -n ">" read if_dst echo -n "Copying $if_src to $if_dst...ctrl-c to abort." read ifdir_src=$ifdir/$if_src ifdir_dst=$ifdir/$if_dst cp -R $ifdir_src $ifdir_dst for file in $(find $ifdir_dst -type f); do if [ $(fgrep -c $if_src $file) != 0 ]; then sed "s/$if_src/$if_dst/g" $file>/tmp/$if_src.tmp mv /tmp/$if_src.tmp $file fi done