#nfs 客户端挂载输入服务端 ip 及目录,客户端目录 判断输入是否正确count=0tips=("Please enter nfs server IP :" "Please enter nfs server dir eg /data :" "Please enter local mount dir eg /mnt :")while [ ${count} -lt 3 ] do usag=${tips[$count]} read -p "$usag" values[${count}] #ip addr is legal? if [ ${count} -eq 0 ];then #echo "ip addr is : ${values[0]}" len=`echo "${values[0]}"|awk -F "." '{print NF}'` #echo "ip adr length: $len" [ ${len} -ne 4 ] && echo "ip addr is illegal value!" && continue else len=`echo ${values[${count}]}|awk '{print length($0)}'` #dir length less than 2 [ ${len} -lt 2 ] && echo "dir is illegal value!" && continue #dir must have / echo ${values[${count}]}|grep "/" &>/dev/null [ $? -ne 0 ] && echo "dir is illegal value!" && continue fi ((count=count+1))doneNFS_IP=${values[0]}NFS_DIR=${values[1]}MOUNT_DIR=${values[2]}