title: Unix - Shell script to find a file from any directory and move it
body: <p>i'm currently working through an exercise book and I have to create a shell script that will find a file from any directory and move it.</p>
  
  <p>Though I am having difficulties as the file could be in any directory (so I do not have a path to find it). I have used the find option with the -print flag tho what would be the next step to move it using mv command?</p>
  
  <p>My code so far reads in a variable, detects if a file has been entered, if it is a file or a directory, or if it exists.</p>
  
  <p>The next stage as mentioned above is to find the file and then move it into a "test" file.</p>
  
  <p>If anyone has any recommendations it would be greatly appreciated.</p>
  
  <pre><code>#!/bin/bash
  
  bin="deleted"
  
  if [ !  -e bin ] ; then
      mkdir $bin
  fi
  
  file=$1
  
  #error to display that no file has been entered
  if [[ ! $file ]]; then
      echo "no file has been entered"
  fi
  
  #file does not exist, display error message
  if [[ !  -f $file ]]; then
      echo "$file does not exsist!"
  fi
  
  #check to see if the input is a directory
  if [[ -d $file ]]; then
      echo "$file is a directory!"
  
  if [[ -e $file ]]; then *** move to test folder
  ****This is where I am having the problems
  </code></pre>