I am a new bash
learner. I want to know, how to take a list of string from standard input? After taking all of the strings, I want to print them space separated.
Say the input is like the following:
Namibia
Nauru
Nepal
Netherlands
NewZealand
Nicaragua
Niger
Nigeria
NorthKorea
Norway
The output should be like:
Namibia Nauru Nepal Netherlands NewZealand Nicaragua Niger Nigeria NorthKorea Norway
I just can read a variable in bash
and then can print it like the following:
read a
echo "$a"
Please, note that :
This question does not answer my question. it is mainly on traversing a declared array. but my case is handling the input and appending the array in runtime as well as detecting the
EOF