Answers for "array in shell"

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
1

bash array

ss="abcdefghi"
my_array=( `echo $ss | grep -o . ` ) # split word into array

echo ${my_array[2]} 
give c

i=0
echo ${my_array[$i]}${my_array[$i+1]}xxx
give : abxxx
Posted by: Guest on August-23-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language