Hello, (name) Problem

#!/bin/bash
echo Hello, please say your name!
read test
echo Hello $test
exit 0

Well im currently trying to run this Script but when I run it on my shell this is the output.

Hello, please say your name! (Output)
Tom <-- (My input)
': not a valid identifier 'test (Output)
Hello (Output)

Could anyone tell me what is the problem?
Thanks

Avoid using "test" as you variable name it is also a builtin command (if you want to look up the manpage about "if" then you run: "man test"), shouldn't be a problem but it evidently is:

#!/bin/bash
echo Hello, please say your name!
read YOURNAME
echo Hello $YOURNAME
exit 0

Well thanks for helping but is not working even though I changed the variable test...

TonyFullerMalv script is sound. This is a mystery so far.

Please post the exact filename of your script, the contents of the script, exactly what you typed to execute the script, and the exact error message you received.

Please also post the output from these three command sequences (they don't change your script - they just provide diagnostics):

pwd
(Where we are now)
ls -ald scriptname
(Exact name and permissions of the script itself)
type scriptname
(Where scriptname is the name of your script).
This is checking where you would find the script in PATH.

sed -n l scriptname
(Where scriptname is the name of your script).
This shows whether the script contains unusual characters such as MSDOS line terminators originating from scripts edited on M$ platforms. It can also reveal hidden characters (such as a colon in your case) which could get into a script if the terminal key mapping is wonky.

ls -lad test
type test
(Just checking whether you have a script called "test" which is interfering with the "test" command).

There's nothing wrong with your script.

Did you write on a Windows box? If so, you must get rid of the carriage returns before you run it on a *nix machine.