shell脚本里读取命令行参数
来源:互联网 发布:mac上用什么输入法 编辑:程序博客网 时间:2024/06/02 06:08
#!/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####";
0 0
- shell脚本里读取命令行参数
- shell 读取命令行参数
- shell脚本 简单的从命令行读取参数
- linux shell读取命令行参数
- TCL脚本读取命令行参数
- 命令行参数解析 - Shell 脚本
- 如何读取shell的命令行参数
- 在Shell脚本中处理命令行参数
- Shell脚本学习-命令行参数处理
- Getopts获取shell脚本命令行参数
- Getopts获取shell脚本命令行参数
- Shell脚本学习-命令行参数处理
- shell脚本循环读取参数,文件批量重命名
- shell脚本读取文本文件调用其他脚本传递获取参数
- shell脚本接收来自命令行传入的参数:
- 脚本乐园 shell中getopts命令行参数处理
- 脚本乐园 Shell中命令行选项和参数的处理
- Linux命令行与shell脚本(9)--函数参数
- 将NTFS库编译进testdisk/photorec - CYGWIN平台
- spring data jpa Specification 多对一检索
- 让网页变灰色
- oracle chain
- 搜索引擎到人工智能的终极演进
- shell脚本里读取命令行参数
- Android中的系统广播集合
- TQFP 和LQFP 器件的焊接方法
- uva 10167 - Birthday Cake
- web maven jetty Unable to find a javac compiler
- Ubuntu “无法获得锁”解决方案(E: 无法获得锁 /var/cache/apt/archives/lock – open (11 资源临时不可用)
- 关于UIWebView的一些应用,包括与JS交互,前进,后退等
- 极限编程的集成测试工具-Dunit
- Count The Carries