title: Need help to write shell script to check if file exist or not?
body: <p>I am trying to write a script which will tell if the file or directory exist or not. It will take the input " file name " from the user.
  First this will put the <code>ls -l</code> or <code>ls</code> output to a file and then take input from user (for filename), later will use if condition to check if file exist or not. But my code is not working.</p>
  
  <pre><code># !/bin/bash
  ls  &gt; listtst.txt 
  read -p "type file name" a
  if [ listtst.txt  ==  $a  ];
    then
       echo "file is present $a"
    else
      echo "file not present"
  fi
  </code></pre>