wildcards in "if then" statement

Hello,

I would like to use a simple "if then" test to check if an argument to a command begins with "http://" as follows:

if [[ $2 == http://* ]]; then

command
fi

but the wildcard just seems to be ignored, ie., it will only execute the command if the expression is strictly "http://" with nothing following it. I have tried enclosing the second expression with single and double quotes, and have tried using various wildcards such as ".", "?", ".*", etc. to no avail.

Any suggestions?

Thank you,

Allasso Travesser

apologies,

I wasn't using the double brackets (thought I was...)

Problem solved-

Thanks, Allasso

Here is an example of one way of doing it using expr(1)

#/bin/ksh

name="http://www.fpm.org"
echo $name

if [ `expr "$name" : ^http:\/\/\*` -eq 7 ]
then
    echo "match"
else
    echo "no match"
fi

Or case statement

case "$2" in
http://* )
      dothing
      ;;
ftp://* )
      dosomethingelse
      ;;
* )
     dodefaultthing
     ;;
esac

A single equal sign should be all it takes to make the if-fi work.

if [[ $2 = http:* ]]; then
   command
fi

The [[ ... ]] syntax is non-standard, but all Bourne-type shells have case:

case $2 in
     http://*) command ;;
esac