#!/bin/ksh
#echo "$1"
echo "@@@@@@@@ cpcode begin @@@@@@@@"
if [ $# != 1 ] || [ -z "$1" ]
then
echo ">>> Usage:cpcode FileName|\"*\""
echo "@@@@@@@@ cpcode finished @@@@@@@@"
exit 1
fi
FileName=$1
#SrcDir=$(pwd)
SrcDir=$PWD
SrcAddr=${SrcDir}/${FileName}
if [[ $SrcDir == /vobs* ]];
then
echo "Choose one of the following dstinamtion:"
echo
echo "[1]--->/berry/berry_main"
echo "[2]--->/cherry/cherry_main"
echo "[3]--->/durian/durian_main"
read Seq
case "$Seq" in
"1") DstPrePath=/mnt/huimingf/code/berry/berry_main/vobs;;
"2") DstPrePath=/mnt/huimingf/code/cherry/cherry_main/vobs;;
"3") DstPrePath=/mnt/huimingf/code/durian/durian_main/vobs;;
*)echo "===error choice ${Seq}======"
exit 1 ;;
esac
elif [[ $SrcDir == /mnt/huimingf/code/* ]];
then
DstPrePath=/vobs
else
echo "<========================== Input Error:Please Come in Code Directory==========================>"
echo "such as:"
echo "/vobs/lc/fa_lxhrp_ot/internal/pkg/ot_base/ot_11dpe12a"
echo "/mnt/huimingf/code/xxxx/xxxx/vobs/lc/fa_lxhrp_ot/internal/pkg/ot_base/ot_11dpe12a"
exit 5
fi
PostPath=${SrcDir##*/vobs/}
DstDir=${DstPrePath}/$PostPath
if [ ! -d "$DstDir" ]
then
echo "<========================== Error:Destimation directory not exit ==========================>"
echo "please check directory:$DstDir"
exit 4
fi
echo "sourc:$SrcAddr"
echo "dest:$DstDir"
echo "[yes] or [no]"
read Flag
if [ $Flag == "yes" ]
then
cp $SrcAddr $DstDir
else
echo "@@@@@@@@ cpcode finished @@@@@@@@"
exit 1;
fi
echo "@@@@@@@@ cpcode finished @@@@@@@@"