Files
bash-tut/arrays/access.sh

18 lines
281 B
Bash
Executable File

#! /usr/bin/bash
# File: access.sh
# Array of numbers
fib=(0 1 2 3 5 8)
#Array of Strings
family=("Marge","Homer","Bart","Lisa","Maggie")
# outputs only element 0
echo "fib=${fib}"
# output the whole array
echo "fib=${fib[@]}"
#output element by index
echo "fib[4]=${fib[4]}"