Skip to content

Commit

Permalink
Arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
Prateek Bhaisora authored and Prateek Bhaisora committed Jan 22, 2024
1 parent 75b0924 commit 0d00844
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions 05_arrays.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# Array

myArray=( 1 20 30.5 Hello "Hey Buddy!" )

echo "All the values in the array are: ${myArray[*]}"

echo "Value at 3rd index is ${myArray[3]}"

# Finding length of Array

echo "Length of the array is ${#myArray[*]}"

echo "Values from index 2 to 3 are: ${myArray[*]:2:2}"

# Updating our Array with new values

myArray+=( New 30 40 )

echo "Values of new array are: ${myArray[*]}"

0 comments on commit 0d00844

Please sign in to comment.