shell 數組


實例一:基本定義 運用shell的數組shell

#!/bin/bash
#by xxx at 2016
#定義數組 並賦值
log_file_name=(access error licess)
#獲取數組的長度
log_file_num=${#log_file_name[@]}
echo $log_file_num 
for  ((i=0;i<$log_file_num;i++))
do
#獲取數組的下標爲i的值,數組的下標是從0開始的
    echo ${log_file_name[i]}
done
相關文章
相關標籤/搜索