#!/bin/bash
usage_msg="USAGE:`basename $0` -h <hadoop 1 namenode ip> -t <table>"
if [[ $# -ne 4 ]];then
echo $usage_msg
exit 1
fi
while getopts h:t: opt; do
case $opt in
h)
namenode=$OPTARG
;;
t)
tablename=$OPTARG
exit 1
;;
esac
echo "option -t not specified"
echo "$OPTIND"
fi
echo "####copy table:$tablename####";
usage_msg="USAGE:`basename $0` -h <hadoop 1 namenode ip> -t <table>"
if [[ $# -ne 4 ]];then
echo $usage_msg
exit 1
fi
while getopts h:t: opt; do
case $opt in
h)
namenode=$OPTARG
;;
t)
tablename=$OPTARG
;;
#如果参数不对,程序退出
\?) echo $usage_msgexit 1
;;
esac
done
#判断参数是否正确赋值
if [ -z $tablename ] ; thenecho "option -t not specified"
echo "$OPTIND"
fi
echo "####copy table:$tablename####";