#!/bin/bash # 建立一個陣列 arr=(1 2 3 4 5) # 迴圈遍歷陣列的每一個元素 for i in "${arr[@]}"; do # 處理每一個元素 # echo $i printf "%s\n" "$i" done