How to compare a command line parameter with -- in shell scripting

Hi,

I need to check if a parameter provided at the command line is equal to --.How can i do that ? Please help me.

Thanks and Regards,
Padmini

Did you mean

if [ "$1" = "--" ]
then
  echo Matching with --
else
  echo Not matching with --
fi

yes but am actually accessing the arguments with the arg variable in a for loop.so how can i compare the value of the arg variable with "--"

Still I am not clear, if you want to compare value of variable 'args' with '--'. It can be done like below

if [ "$args" = "--" ]
then
  echo Matching with --
else
  echo Not matching with --
fi
#!/bin/yoursh

usage()
{
   cat <<EOF >&2
   hello world
EOF
}

## main ##

flag1=""
while [ $# -gt 0 ] 
do 
     arg="$1" 
     case "$arg" in 
            -d) flag1="$2"; shift ;; 
            --) shift; break ;;
            -*) usage ;; 
            *) break ;; # - interrupt this loop, this is argument, not option
     esac
     shift
done

# now you can handle arguments using while or for
for arg in $*
do
    yep "$arg"
done