2018年8月27日 星期一

shell script array

#!/bin/sh

p1="1 2 3 4 5 6 7"
p2="sun mon tue wed thu fri sat"

i=0
for y in $p1 ; do 
  ar1[$i]=$y
  i=$i+1;
done


j=0
    for y in $p2 ; do
        echo ${ar1[$j]},$y
        j=$j+1
    done


沒有留言:

張貼留言