Answers for "output of command to array bash"

1

bash print array

echo "${array[*]}"
Posted by: Guest on August-04-2020
0

store command into array bash

#Just use following structure to store output of command into a variable:
var=$(command)
#For example:
var=$(echo 'hi')	#store hi into var
array=($(ls))	#store list of files into var
Posted by: Guest on December-08-2020
0

how to print array bash

echo  ${resnew[0]} - first element
echo  ${resnew[1]}  - second element 


echo last : ${resnew[$(($res_len -1))]}  last element

echo last : ${resnew[        $(($res_len -1))                              ]}  last element
             ^resnew_array[  ^get value from varible by solving $res_len-1  ^array close
Posted by: Guest on August-21-2021

Code answers related to "output of command to array bash"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language