懒龙谷
  • Home
  • Categories
  • Tags
  • Archives

ksh_数组

% ksh数组的使用方法

一、 定义

定义与初始化数组变量:

set -A name value1 value2 ... valuen

对应bash定义形式

arr =(element1 element2 element3...... )

给数组赋值也可以定义数组:

name[index]=value

注意

下标是从0开始

二、 使用

访问数组变量:

${name[index]}

一次访问数组变量中的所有元素:

${name[*]}

${name[@]}

this guy is lazy, nothing leave

Comments
comments powered by Disqus

  • « shell_时间
  • find_grep »

Published

Jun 6, 2014

Category

shell

Stay in Touch

  • Powered by Pelican. Theme: Elegant by Talha Mansoor