To execute any file (well, any executable file, whether it's a shell script, program, etc.), you type the full path to that file. For example,
to run the program "gaim" located in the directory "/usr/local/bin"
If you're already in the directory "/usr/local/bin" then you can abbreviate the full path using a single dot, which stands for the current directory. Therefore, in:
"./gaim" gets expanded to "/usr/local/bin/gaim" since "/usr/local/bin" is your current location.
There is one exception to this rule. If you type the name of a file/program without using the full path, the shell looks for it in the directories in your PATH environment variable and, if it finds it there, runs it. Type "echo $PATH" to see all the directories in your PATH. Since "/usr/local/bin" is in your PATH, you can simply type "gaim" and it will be executed.
When all else fails and you want to be sure a particular script is being executed, type the full path to make sure it's not running something else with the same name in one of the directories in your PATH.
To see why you're getting the permission denied error, type "ls -l test" to see the permissions of the script. You probably haven't set it to be executable (it's just a normal file that can't be run unless you let people execute it). Try "chmod 744 test" to change that.