Escaping '*' in Bash

I have the following situation

============
export DirectoryName=/tmp/xyz

if [ -d $DirectoryName ] ; then

some_new_env=$DirectoryName"/*"

I tried all the ways of escaping the '', but still the shell seems to expand the '' character. I want some_new_env to contain "/tmp/xyz/*"

Any ideas?

try:
set -f

before using the * or use single quotes when defining it and double quotes around the full expression later.

$ echo *
test1 test2 test3
$ set -f
$ echo *
*
$ set +f
$ a='*'
$ echo "$a"
*

set f command disables globbing

how do I re-enable it after I am done with 'set -f'?

use

set +f

Got it ' set +f *'!!

Thanks very much to both you for your prompt help!

cheers

Use either an single quote '
or
Use backslash to escape the special characters
or
Turn of globbing by using "set -f " in the above script

Check this for more : UNIX Shell Quotes - a simple tutorial

Thanks,
Nagarajan Ganesan.

When you make an assignment with a value containing a wildcard, it is not expanded. Try this:

some_new_env=$DirectoryName"/*"
echo "$some_new_env"

The shell expands it when you use the variable. If you quote the variable, the expansion is suppressed.