There have been plenty of scripts so far with variables, but can bash deal with an array of variables?
Arrays are easy to initialize if you know the values as you write the script. The format is simple:
MYRA=(first second third home)
Each element of the array is a separate word in the list enclosed in parentheses. Then you can refer to each this way:
echo runners on ${MYRA[0]} and ${MYRA[2]}
This output is the result:
runners on first and third
If you write only $MYRA
, you
will get only the first element, just as if you had written ${MYRA[0]}
.
18.223.195.29