#!/bin/bash

emp_info=(
aaa aaa@qq.com
bbb bbb@qq.com
ccc ccc@qq.com
ddd ddd@qq.com
eee eee@qq.com
) for i in ${!emp_info[@]}
do
if [ `expr $i % ` = "" ] # get mail addr
then
name=${emp_info[`expr $i - `]}
mailaddr=${emp_info[$i]}
mobile=${emp_info[`expr $i - `]}
echo $name $mobile $mailaddr
fi
done

Shell数组遍历的更多相关文章

  1. shell 数组遍历加引号和不加引号的区别?

    前言 shell 是一个比较神奇的国度,里面有太多的坑需要填,今天需要填的坑就是,数组遍历在使用时加了引号和不加引号的区别. 案例 解析: 不加引号,数组中元素间的“空格”就会编程换行符 加引号,  ...

  2. Linux Shell 数组

    shell 数组一般都是一维数组. 1. 数组的声明 declare -a arr 该命令将声明一个数组arr,实际上不声明也可以直接定义数组. 2. 数组的初始化 arr=(1 2 3):该命令定义 ...

  3. 教你使用shell数组

    数组的使用,需要掌握 1.对数组进行赋值 2.通过下标访问数组元素 3.循环遍历所有的元素 代码如下: #!/bin/bash a="39" b="5" c=& ...

  4. linux shell数组

    from: http://www.jb51.net/article/34322.htm bash shell只支持一维数组,但参数个数没有限制. 声明一个数组:declare -a array(其实不 ...

  5. SHELL脚本--shell数组基础

    bash&shell系列文章:http://www.cnblogs.com/f-ck-need-u/p/7048359.html 数组和变量的区别是:变量在内存中占用的空间是离散的,数组在内存 ...

  6. shell 数组,双层循环打印变量

    双层循环,打印循环执行次数. 特别注意 ,shell 脚本赋值时 '=' 两侧不能有空格,否则报错,shell command not found 但在if 语句中需要有: STR1="ab ...

  7. shell数组应用

    引言 在Linux平台上工作,我们经常需要使用shell来编写一些有用.有意义的脚本程序.有时,会经常使用shell数组.那么,shell中的数组是怎么表现的呢,又是怎么定义的呢?接下来逐一的进行讲解 ...

  8. shell 数组基础->

    数组其实也算是变量, 传统的变量只能存储一个值, 但数组可以存储多个值. 普通数组:只能使用整数 作为数组索引 [有序 0 1 2 3 4 ]关联数组:可以使用字符串 作为数组索引 [无序 name ...

  9. 2016/3/20 数组定义 数组遍历 超全局数组 数组元素设置(in_array() 、array_reverse()、count()、array_unique()、unset()、array_values、array_merge、array_push) 列表实例

    一.数组定义 php数组与其他语言的数组的不同: 其他例如java语言 :同一种类型数据的集合. php:数组可以存储任何类型的数据.同一个数组中可以放int类型也可以放string类型 ①索引数组的 ...

随机推荐

  1. mongodb MongoDB 聚合 group(转)

    MongoDB 聚合 MongoDB中聚合(aggregate)主要用于处理数据(诸如统计平均值,求和等),并返回计算后的数据结果.有点类似sql语句中的 count(*). 基本语法为:db.col ...

  2. databus编译:Could not resolve all dependencies for configuration ':databus2-relay:databus2-event-producer-mock:compile

    FAILURE: Build failed with an exception. * What went wrong: Could not resolve all dependencies for c ...

  3. xpath的常见操作

    1. 获取某一个节点下所有的文本数据: data = response.xpath('//div[@id="zoomcon"]') content = ''.join(data.x ...

  4. kafka 监控(eagle)

    topic:创建时topic名称 partition:分区编号 offset:表示该parition已经消费了多少条message logSize:表示该partition已经写了多少条message ...

  5. (原创)拨开迷雾见月明-剖析asio中的proactor模式(一)

    使用asio之前要先对它的设计思想有所了解,了解设计思想将有助于我们理解和应用asio.asio是基于proactor模式的,asio的proactor模式隐藏于大量的细节当中,要找到它的踪迹,往往有 ...

  6. django rest_framework入门五-认证和权限

    1.django User实体 django自带了用户验证模块,django/contrib/auth/models.py定义了用户实体,代码如下: class AbstractUser(Abstra ...

  7. 【Android】Android消息处理机制

    三大核心类 android的消息处理有三个核心类:Looper,Handler和Message. 其实还有一个Message Queue(消息队列),但是MQ被封装到Looper里面了 Looper ...

  8. ss安装

    安装很简单,如下: apt-get install python-pip pip install shadowsocks 配置文件格式如下: { "server":"0. ...

  9. Eclipse报This version of the rendering library is more recent than your version of ADT ...

    http://blog.csdn.net/zhao_3546/article/details/12968295 最近使用 Help --> Check for Updates 升级了Eclips ...

  10. LeetCode: Construct Binary Tree from Inorder and Postorder Traversal 解题报告

    Construct Binary Tree from Inorder and Postorder Traversal Given inorder and postorder traversal of ...