I have attempted to create an array consisting of two items: #0 and #1.
I am able to print the two items corrctly:
However, when I try to run a for loop to print both objects:
I get:
If there are two objects, why is the output on four lines? How do I loop on two lines?
My goal is to get:
I am able to print the two items corrctly:
Code:
arr=(hello "my name is")
echo ${arr[0]}
hello
echo ${arr[1]}
my name is
Code:
for i in ${arr[*]}
do
echo $i
done
Code:
hello
my
name
is
My goal is to get:
Code:
hello
my name is