Parse a line by a space

I am trying to show each word on a separate line, but read in all the words on one command line. Below is the code I have right now:

read name
MyString=$name
name2=" "
echo $MyString | awk -v ORS="" '{ gsub(/./,"&\n") ; print }' | \
while read char
do
        if [ "$char" = "name2" ]
        then
            echo "$final"
            echo "in here"
            final=""
        else
            final=`echo $final $char`
        fi      
done

For some reason it is not working. What am I doing wrong?

Want to read in:

testing this program

and want to show on the screen

testing
this
program

Any help would be appreciated.

tr -s ' '  '\n' < inputfile 

Try that

Try out this to replace space with new lines

echo $name | tr '\040' '\012'

itslee - i tried that and its good, but now I want to put each of those words into an array. So i can do some things on each of those strings passed etc.

What shell do you use?

its on a linux server. #!/bin/bash

#!/bin/bash

read -a ARR

# echo all elements of array ARR
echo ${ARR[*]}

# echo element no. 2 of array ARR (Index starts at 0)
echo ${ARR[1]}

# echo number of elements
echo ${#ARR[*]}

try this...

i=0
echo $name | tr '\040' '\012' | while read output
do 
  myval=$output
  i=`expr $i + 1`
done

thanks for everyone's help. I got it working I think.