[root@10-6-8-200 test]# testarr=(a b c d e f) //字义数组[root@10-6-8-200 test]# echo ${testarr[0]} //打印第一位数组a[root@10-6-8-200 test]# echo ${testarr[*]} //打印所有数组a b c d e f[root@10-6-8-200 test]# echo ${testarr[@]} //同上a b c d e f[root@10-6-8-200 test]# echo ${#testarr[@]} //打印数组的长度6[root@10-6-8-200 test]# echo ${#testarr[*]} //同上6#!/bin/basharr=(a b c d e f)for ((i=0;i<${#arr[*]}-1;i++));do echo $i time: for ((j=i+1;j<${#arr[*]};j++)) do echo -n ${arr[$i]}${arr[$j]}" " done echodone[root@10-6-8-200 test]# bash test.sh0 time:ab ac ad ae af1 time:bc bd be bf2 time:cd ce cf3 time:de df4 time:ef