Created
July 14, 2022 02:24
-
-
Save changx03/9c001f3b3f8a31cdcca44f5bb6b88fc2 to your computer and use it in GitHub Desktop.
Access an element from an array using index in bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# To access banana | |
DATA=("apple" "banana" "cherry") | |
IDX=1 | |
echo ${DATA[$IDX]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment