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中,每一个变量的值都是字符串.无论你给变量赋值时,有没有使用引号,值都会以字符 ...
随机推荐
- HDU 4638Group (莫队)
Group Problem Description There are n men ,every man has an ID(1..n).their ID is unique. Whose ID is ...
- 【附4】springboot源码解析-run()
public ConfigurableApplicationContext run(String... args) { StopWatch stopWatch = new StopWatch(); / ...
- CSS3 常用选择器
p:last-of-type{background-color: red;} 选择p中最后一项 p:nth-of-type(2n){background-color: red;} 隔行变色里面也可以填 ...
- [Shiro] - 基于URL配置动态权限
基于shiro进阶 更改了数据库表 之前的PageController是通过@RequiresPermissions和@RequiresRoles进行是否有权限/是否有角色的判定调用@RequestM ...
- Cent OS 常用配置命令
1.ifconfig #查看网络接口状态 2.ifconfig –a #查看主机所有接口的情况 3.ifconfig eth0 192.168.1.106 netmask 255.255.255 ...
- [ios]NSThread传值 NSValue传值
NSThread:http://www.cocoachina.com/bbs/read.php?tid=51873 NSValue:http://blog.sina.com.cn/s/blog_bf9 ...
- Android 实现文件上传功能(upload)
文 件上传在B/S应用中是一种十分常见的功能,那么在Android平台下是否可以实现像B/S那样的文件上传功能呢?答案是肯定的.下面是一个模拟网站程 序上传文件的例子.这里只写出了Android部分的 ...
- MySQL函数GROUP_CONCAT() 实现多条数据合并
group_concat()会计算哪些行属于同一组,将属于同一组的列显示出来,group by指定的列进行分组. 例如: -- 根据物流订单id查询所有物流订单,车源订单,车辆信息(多条数据合并为一条 ...
- Python 爬虫-获得大学排名
2017-07-29 23:20:24 主要技术路线:requests+bs4+格式化输出 import requests from bs4 import BeautifulSoup url = 'h ...
- C#中类的序列化和反序列化
说明:本文演示将类序列化后写入记事本并从记事本读取反序列化为对象1.首先创建一个类,同时类必须标识为Serializable,如下: [Serializable] public class Regio ...