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
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).