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)的更多相关文章

  1. Deep Learning模型之:CNN卷积神经网络(一)深度解析CNN

    http://m.blog.csdn.net/blog/wu010555688/24487301 本文整理了网上几位大牛的博客,详细地讲解了CNN的基础结构与核心思想,欢迎交流. [1]Deep le ...

  2. 老李分享:《Linux Shell脚本攻略》 要点(八)

    老李分享:<Linux Shell脚本攻略> 要点(八)   1.打印进程 [root@localhost program_test]# ps -e | head  PID TTY     ...

  3. 老李分享:《Linux Shell脚本攻略》 要点(七)

    老李分享:<Linux Shell脚本攻略> 要点(七)   1.显示给定文件夹下的文件的磁盘适用情况 [root@localhost program_test]# du -a -h ./ ...

  4. 老李分享:《Linux Shell脚本攻略》 要点(六)

    老李分享:<Linux Shell脚本攻略> 要点(六)   1.打印网络接口列表 [root@localhost touch_more]# ifconfig | cut -c-10 | ...

  5. 老李分享:《Linux Shell脚本攻略》 要点(五)

    老李分享:<Linux Shell脚本攻略> 要点(五)   //1.打包.解包 [root@localhost program_test]# tar -cf output.tar 11. ...

  6. 老李分享:《Linux Shell脚本攻略》 要点(四)

    老李分享:<Linux Shell脚本攻略> 要点(四)   1.IP地址的正则表达式: [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} 2. ...

  7. 老李分享:《Linux Shell脚本攻略》 要点(三)

    老李分享:<Linux Shell脚本攻略> 要点(三)   1.生产任意大小的文件 [root@localhost dd_test]#[root@localhost dd_test]# ...

  8. 老李分享:《Linux Shell脚本攻略》 要点(二)

    老李分享:<Linux Shell脚本攻略> 要点(二)   poptest是国内唯一一家培养测试开发工程师的培训机构,以学员能胜任自动化测试,性能测试,测试工具开发等工作为目标.如果对课 ...

  9. 老李分享:《Linux Shell脚本攻略》 要点(一)

    老李分享:<Linux Shell脚本攻略> 要点(一)   第一章:Shell起步基础 1.变量:在bash中,每一个变量的值都是字符串.无论你给变量赋值时,有没有使用引号,值都会以字符 ...

随机推荐

  1. 不是最强大的vimrc

    一直都是使用vim作为我的主要编辑器,它大大提高了我的代码编辑效率.vim的配置高度灵活.插件丰富,恐怕100个人就有99种配置方法,网上关于vim配置的所谓“最强大的vimrc”之类的文章不少,博人 ...

  2. Java求两个数平均值

    如何正确的求2个数的平均值.在练习算法二分查找的时候发现的,以前没有注意到的bug 备注:数据以int类型为例 一.以前的通用写法 /** * 求a+b平均值 * @param a * @param ...

  3. C++for的几种方式

    #include <algorithm> #include <vector> ////////////////////////////////////////////// , ...

  4. cogs 444. [HAOI2010]软件安装

    ★★☆   输入文件:install.in   输出文件:install.out   简单对比 时间限制:1 s   内存限制:128 MB [问题描述]现在我们的手头有N个软件,对于一个软件i,它要 ...

  5. sql逻辑查询语句的执行顺序

    SELECT语句关键字的定义顺序 SELECT DISTINCT <select_list> FROM <left_table> <join_type> JOIN ...

  6. [oracle复习] - Oracle

    https://deadzq.github.io/oracle/Oracle.html 我的oracle笔记1 https://deadzq.github.io/oracle/Oracle2.html ...

  7. com.mysql.jdbc.PacketTooBigException,及mysql 设置 max_allow_packet

    本文为博主原创,未经允许不得转载: 在进行批量导入表格数据入库操作时,报了以下错误: 错误分析: mysql根据配置文件会限制server接受的数据包大小.有时候大的插入和更新会受max_allowe ...

  8. input标签type=button时,如何禁用和开启按钮

    本文为博主原创,未经允许不得转载: <input id="exportCameraButton" type="button" class="bt ...

  9. UVa 1590 IP网络(简单位运算)

    Description   Alex is administrator of IP networks. His clients have a bunch of individual IP addres ...

  10. idea 2018注册码(激活码)永久性的

    2DZ8RPRSBU-eyJsaWNlbnNlSWQiOiIyRFo4UlBSU0JVIiwibGljZW5zZWVOYW1lIjoiY24gdHUiLCJhc3NpZ25lZU5hbWUiOiIiL ...