Skip to content

Commit

Permalink
For loop over an array
Browse files Browse the repository at this point in the history
  • Loading branch information
Prateek Bhaisora authored and Prateek Bhaisora committed Jan 23, 2024
1 parent 01af09d commit a1005ec
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions 16_forloop-array.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

myArray=( 1 2 3 Hello Hi)

length=${#myArray[*]}

for(( i=0; i<$length; i++ ))
do
echo "Value of array is ${myArray[$i]}"
done

0 comments on commit a1005ec

Please sign in to comment.