Problem in Passing sql query for a script

Unix prompt

echo "Enter the query"
read q

User has entered :
SELECT * FROM employee

Now the problem starts..

echo $q

Output: SELECT "all files names in the PWD" FROM employee

================================================

Problem is that whenever I am passing a query \(The query result should be stored in a variable \) containing '*'  and passing the variable to a script

then the in the variable "SELECT 'all files names in the PWD' FROM employee" is stored instead of the actual query "select * from employee " .
How to avoid special meaning of ''?
Here '\' before '
' is also not working...
plz help...

Do you know about globbing?

either use '*' or use set -f to turn off globbing before you run your shell script

Actually echo "$q" with double quotes prevents the globbing. The value in q does not have the wildcard expanded, it's when you use it without properly quoting it that you get the file names globbed.

I should show the code itself..
echo "enter ur query"
read q

( sleep 1
echo "niroj_p"
sleep 1
echo "*******"
prompt off
echo "`dbaccess db_nm<< EOFSQL 2>> /dev/null/
$q; # line:here I am getting problem
EOFSQL`" > nilu.tmp
sleep 1
echo "exit") | telnet remote_nm

================================
If I will use "$q" as told by era in the error line(shown above in green )then :

+read q
select * from events

+ dbaccess db_nm
+ 0<<
"select * from ods_event";
2>> /dev/null/

Giving error
------------------------------------------------

Thanx jim 'set -f' is working nice

What's the point of the echo around the backticks?

dbaccess db_nm<<EOFSQL >nilu.tmp 2>/dev/null/
$q;
EOFSQL

I don't get wildcards with this, but you might put double quotes in <<"EOFSQL" if you do.