Storing user inputs into a file

Hi,
Am trying to store the user inputs into a file, but the below code will store only the first line of the values. I need to store all the user input values which may contain one or more lines. Thanks in advance.

echo "please enter file names";
read name;
echo $name>/tmp/test

Try:

echo "please enter file names"
while read name
do
  echo "$name"
done >/tmp/test

is the syntax correct. It's not working for me

Please provide your inputs and expected output as well!!

What isn't working?

My requirement is to get multiple names from user and store in a file name . Here the below code is working for a single name , but need the same for multiple names.

echo "Please enter file names:"
read name
echo $name>/tmp/test

If I try the below code the file names are getting populated into the file but am not able to perform the task using those values. Not sure whether the script identifies whether the file EOF is reached or not. After storing into the file its not working further.

echo "please enter file names"
while read name
do
  echo "$name"
done >/tmp/test

My requirement is to get multiple names from user and store in a file name . Here the below code is working for a single name , but need the same for multiple names.

Code:
echo "Please enter file names:"
read name
echo $name>/tmp/test
If I try the below code the file names are getting populated into the file but am not able to perform the task using those values. Not sure whether the script identifies whether the file EOF is reached or not. After storing into the file its not working further.

Code:
echo "please enter file names"
while read name
do echo "$name"
done >/tmp/test

Bumping up posts or double posting is not permitted in these forums.

Please read the rules, which you agreed to when you registered, if you have not already done so.

You may receive an infraction for this. If so, don't worry, just try to follow the rules more carefully. The infraction will expire in the near future

Thank You.

The UNIX and Linux Forums.

The script identifies when EOF is reached, yes. When that happens, read fails and the loop breaks. Hitting ctrl-D in the shell will act like EOF, too.

How can your code 'not work further' when there isn't any more code at all? It's not doing anything with the file, because you never tell it to.

What have you tried?

Did you send an EOF after you entered all filenames? EOF is generated by pressing ctrl+d.

Thanks its working. Is it possible to type any word by user like quit or exit to identify EOF instead of pressing ctrl-d

[ "$LINE" = "quit" ] && break