how to check if masked directory exists?

I'm trying to write a script that identifies whether a directory of the form AWL.????????.IP exists. I have one that exists which is AWL.05301032.IP.

When I test like this: If [[ -d AWL.05301032.IP ]]

I get true, but when I test like this:
If [[ -d AWL.????????.IP ]]
Or like this
If [[ -d AWL.*.IP ]]
Or any other variation of wild cards, I get false.

Is there a way for me to check for the presence of a directory that uses a mask?

Thanks for any help that can be provided!

Phil Plasma

The problem is your wild cards are expanding into multiple items.

Try something like the following

for d in AWL.????????.IP 
do
     if test -d $d
     then
           echo $d exists
     fi
done

Thanks for the quick reply, Porter, but it didn't work. First I ran it as is and got nothing, then I modified it as such:

for d in AWL.????????.IP 
do
     echo $d
     if test -d $d
     then
           echo $d exists
     fi
done

And what printed to the screen was

AWL.????????.IP

This is a ksh on a windows server using MKS Toolkit.

If you get back "AWP.????????.IP" then nothing matched the expression.

The way general expressions work in the shell is if there are file matches those that match are returned, else the expression.

Can you do "ls -l" for us to see what you are seeing?

It might be a case sensitivity type thing, note, windows file systems are case-insensitive, UNIX ones are normally case-sensitive.

You might need to try "awp.????????.ip" or some variation.

thanks so much, it works now. It even worked before only I had made the mistake of looking for AWL..IP which is the standard for all of my other customers, but for this customer the directories are called TL..IP, so your first reply as to how to fix this succeeded.

Sorry about the extra reply I had to draw from you.

Thanks again!

Phil Plasma