Skip to content

Commit 1fb34af

Browse files
committed
Add all about Working with Arrays
1 parent 1166175 commit 1fb34af

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

bourne_again_shell/arrays.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
# Declaring an array
4+
fruits=("Apple" "Banana" "Orange" "Grapes")
5+
6+
# Accessing array elements
7+
echo "First fruit: ${fruits[0]}"
8+
echo "Second fruit: ${fruits[1]}"
9+
10+
# Length of the array
11+
echo "Number of fruits: ${#fruits[@]}"
12+

0 commit comments

Comments
 (0)