learning shell args handing key=value example (2)
Shell args handing key=value example
【Purpose】
Learning how to handing ker=value args
【Eevironment】
Ubuntu 16.04 bash env
【Procdeure】
Source code:
# Script parameters handling get left parameters and right value for i in "$@"; do
if [[ $i == *=* ]]; then
parameter=${i%%=*}
value=${i##*=}
display_alert "Command line: setting $parameter to" "${value:-(empty)}" "info"
eval $parameter=$value
fi
done
Test method:
vmuser@vmuser-virtual-machine:~/panzidong/shell$ ./test-args-handing.sh test1=111 test2=2222 test3=
Command line: setting test1 to 111
Command line: setting test2 to 2222
Command line: setting test3 to (empty)
learning shell args handing key=value example (2)的更多相关文章
- Deep Learning模型之:CNN卷积神经网络(一)深度解析CNN
http://m.blog.csdn.net/blog/wu010555688/24487301 本文整理了网上几位大牛的博客,详细地讲解了CNN的基础结构与核心思想,欢迎交流. [1]Deep le ...
- 老李分享:《Linux Shell脚本攻略》 要点(八)
老李分享:<Linux Shell脚本攻略> 要点(八) 1.打印进程 [root@localhost program_test]# ps -e | head PID TTY ...
- 老李分享:《Linux Shell脚本攻略》 要点(七)
老李分享:<Linux Shell脚本攻略> 要点(七) 1.显示给定文件夹下的文件的磁盘适用情况 [root@localhost program_test]# du -a -h ./ ...
- 老李分享:《Linux Shell脚本攻略》 要点(六)
老李分享:<Linux Shell脚本攻略> 要点(六) 1.打印网络接口列表 [root@localhost touch_more]# ifconfig | cut -c-10 | ...
- 老李分享:《Linux Shell脚本攻略》 要点(五)
老李分享:<Linux Shell脚本攻略> 要点(五) //1.打包.解包 [root@localhost program_test]# tar -cf output.tar 11. ...
- 老李分享:《Linux Shell脚本攻略》 要点(四)
老李分享:<Linux Shell脚本攻略> 要点(四) 1.IP地址的正则表达式: [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} 2. ...
- 老李分享:《Linux Shell脚本攻略》 要点(三)
老李分享:<Linux Shell脚本攻略> 要点(三) 1.生产任意大小的文件 [root@localhost dd_test]#[root@localhost dd_test]# ...
- 老李分享:《Linux Shell脚本攻略》 要点(二)
老李分享:<Linux Shell脚本攻略> 要点(二) poptest是国内唯一一家培养测试开发工程师的培训机构,以学员能胜任自动化测试,性能测试,测试工具开发等工作为目标.如果对课 ...
- 老李分享:《Linux Shell脚本攻略》 要点(一)
老李分享:<Linux Shell脚本攻略> 要点(一) 第一章:Shell起步基础 1.变量:在bash中,每一个变量的值都是字符串.无论你给变量赋值时,有没有使用引号,值都会以字符 ...
随机推荐
- 20145337 《网络对抗技术》Web基础
20145337 <网络对抗技术>Web基础 一.实验后回答问题 什么是表单? 表单是HTML的一个重要部分,主要用于将用户输入的信息提交到服务器.如果是普通的HTML页面,则当浏览器提出 ...
- 【第五章】 springboot + mybatis
springboot集成了springJDBC与JPA,但是没有集成mybatis,所以想要使用mybatis就要自己去集成.集成方式相当简单. 1.项目结构 2.pom.xml <!-- 与数 ...
- perl入门知识(3)
引用 在很多场合下使用引用传值,能在很大程度上提高代码的运行效率. 定义一个引用在变量名前加”\”就可以了,如: $ra=\$a; $rb=\@b; ...
- LeetCode——Find Bottom Left Tree Value
Question Given a binary tree, find the leftmost value in the last row of the tree. Example 1: Input: ...
- The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path 解决方法
项目忽然出现 The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Pat ...
- 【TCP/IP详解 卷一:协议】第9章 IP选路
推荐链接:网络地址与主机地址 9.1 引言 路由选择程序(daemon),通常这是一个用户进程.在大多数的Unix系统中,大多数的路由选择程序都是路由程序和网关程序. 路由表经常被IP访问,但是它被路 ...
- MVC ---- IEnumerable<T>、List<T> 前台遍历展示
突然做前台数据展示,发现IEnumerable 对一个列表的展示还是可以,但要是多个类型放在一个表中如何处理呢,如下: 一个类IEnumerable遍历 后台 public IEnumerable&l ...
- 文件上传allowedTypes和文件下载contentType(mimeType)
我们在做文件上传和下载时,常常要用到以下mimeType,下面列出来供大家参考参考!希望多顶顶 '.a' : 'application/octet-stream', '.ai' ...
- [设计模式]工厂模式factory
参考:http://wxg6203.iteye.com/blog/740229 简单工厂模式(simple factory)是类的创建模式,又叫静态工厂方法(static factory method ...
- [ios]ScrollView小结
设置ScrollView self.mysrollview.contentSize = CGSizeMake(1024,768); self.mysrollview.pagingEnabled = Y ...