title: Unix Shell Script to backup a file
body: <p>i am new to shell scripting, i am trying to backup a file "main.sh" to "main.sh.bak" using a shell script. If the file exists perform the copy, else display a message. below is the script i am trying, i need to help in the "if" condition to check if the file exists or not in the current directory.</p>
  
  <pre><code>#!/bin/bash
  
  echo "enter the file name"
  read FILE
  if [ -f $FILE ]; then
      cp $FILE $FILE.bak
      echo "file successfully backed up"
  else
      echo "file does not exists"
      exit 1
  fi
  
  exit 0
  </code></pre>