“Bash for Loop String Array” Ответ

петля от массива

#!/bin/bash
# declare an array called array and define 3 values
array=( one two three )
for i in "${array[@]}"
do
	echo $i
done
Tremendous Enceladus

Bash for Loop String Array

## declare an array variable
declare -a arr=("element1" "element2" "element3")

## now loop through the above array
for i in "${arr[@]}"
do
   echo "$i"
   # or do whatever with individual element of the array
done
Armandres

Пройти через множество струн в ударе

## declare an array variable
declare -a arr=("element1" "element2" "element3")

## now loop through the above array
for i in "${arr[@]}"
do
   echo "$i"
   # or do whatever with individual element of the array
done

# You can access them using echo "${arr[0]}", "${arr[1]}" also
Tremendous Enceladus

Ответы похожие на “Bash for Loop String Array”

Вопросы похожие на “Bash for Loop String Array”

Больше похожих ответов на “Bash for Loop String Array” по Shell/Bash

Смотреть популярные ответы по языку

Смотреть другие языки программирования