Originally Posted by Ejdaha
You probably mean "echo $var", and not "echo var", which would output the string "var" textually, and not the contents of the $var variable.
Now I want the file name to be displayed in this sitaution to :
When trying to expand the wild card with the string "file=>" in front of $var it won't find matches, since it becomes part of the path breaking any meaning it might have. A way to proceed would be to use ls as someone else said, but beware that you need to use the proper syntax to avoid color codes which could screw your script at any given moment. You probably will also have problems with spaces in the middle of the names, depending on what are you doing.
There are many better ways to overcome this, for example, you can add the file=> string at a later stage, after the wildcard expansion has taken place, like this:
for i in $var; do echo "file=>$i"; done
EDITED: By the way, if you don't mind having all the file names on a single line you could as well use separate echos.
echo -n "file=>"; echo $var