Quick Answer: How Do I Print an Array in Linux?
Contents How Do I Print an Entire Array in Linux? Bash Script #! /Bin/Bash. #Script to Print All the Elements of the Array. #Declaring the Array. Declare -a...
Contents
How do I print an entire array in Linux?
Bash Script
- #!/bin/bash.
- #Script to print all the elements of the array.
- #declaring the array.
- declare -a example_array=( “Welcome””To””Javatpoint” )
- #Printing all the elements.
- echo “${example_array[@]}”
How do you print an array element in Unix?
To refer to the value of an item in array, use braces “{}”. The braces are required to avoid issues with pathname expansion. To write all elements of the array use the symbol “@” or “*”.