Compare file name and take action

Have some files in /tmp/dir

abc.zip
123.zip
345.zip

and if name matches to 345.zip then take action
My code....

am i doing something wrong ? Please advise.

#!/bin/bash
set -x
cd /tmp/dir

for i in *.*
do
  if [[ -f "$i" = "345.zip"]]
  then
   echo "do nothing ........
   '
  else
   echo " do something"
done

Running that script you should have seen some error messages. Why don't you post those as well, and be it sheer politeness to give the full picture?

Getiting below error

+ cd /tmp/dir
./a.sh: line 6: syntax error in conditional expression
./a.sh: line 6: syntax error near `='
./a.sh: line 6: ` if [[ -f "$i" = "345.zip"]]'

Please advise ,where its going wrong in syntax.

If you want to know if the file named by the contents of the variable named i is a regular file, use:

  if [[ -f "$i" ]]

If you want to know if the string that is the contents of the variable named i is the string 345.zip , use:

  if [[ "$i" == "345.zip"]]

If you want to know if the file named by the contents of the variable named i is a regular file named 345.zip use:

  if [[ -f "$i" ]] && [[ "$i" == "345.zip"]]

Then note that with your loop (if you have three files one of which is named 345.zip that match the filename matching pattern *.* ) you'll echo do nothing once and echo do something twice. Is that really what you want to do?