Bash的for循環語句可以通過以下方式使用:
for i in {1..5}
do
echo "循環次數:$i"
done
array=("apple" "banana" "orange")
for fruit in "${array[@]}"
do
echo "水果:$fruit"
done
for file in /path/to/directory/*
do
echo "文件名:$file"
done
for item in $(ls)
do
echo "項目:$item"
done
for ((i=1; i<=5; i++))
do
echo "循環次數:$i"
done
請根據具體的需求選擇合適的方式來使用Bash的for循環語句。