09 - Bash Arrays


Example 1:


#!/bin/bash
fruits=("Apple" "Orange" "Banana" "Mango")
echo " "
echo ${fruits[0]}
echo ${fruits[@]} | awk {'print $1'}
echo ${fruits[2]}
echo ${fruits[1]}
echo ${fruits[@]}


OUTPUT

Apple

Apple

Banana

Orange

Apple Orange Banana Mango


Post a Comment

0 Comments