title: bash find parameters
body: <pre><code>#!/bin/bash                                                                                                                                                             
  menu=0
  dir=""
  size=""
  name=""
  modif=""
  while [ $menu -ne 6 ]
  do
      echo "1. Name: $name"
      echo "2. Directory $dir"
      echo "3. Last modified: $modif"
      echo "4. Minimum size: $size"
      echo "5. Search"
      echo "6. End"
      read menu
      case "$menu" in
          "1") read name ;;
          "2") read dir ;;
          "3") read modif ;;
          "4") read size;;
          "5") if [ -z $name ]
               then
                   option1=""
               else
                   option1="-name $name"
               fi
              find "$option1";;
          "6") ;;
          *) echo "Wrong number!"
      esac
  done
  </code></pre>
  
  <p>I need to make a script which will be working like find command, but I've encountered a problem. When user doesnt input for example name the find command should have name option disabled. </p>
  
  <p>I came up with something like this above, but it doestn work when the variable name doesnt contain anything (user didnt input anything). I keep getting error: 
  find: paths must precede expression: BASH ....</p>
  
  <p>I honestly have no idea how to make it work instead of having 2^4 IF's and executing find with only those specified options that user has choosen.</p>
  
  <p>Is there any way to make it easier?</p>
  
  <p>edit: Now i modified it to:</p>
  
  <pre><code>#!/bin/bash                                                                                                                                                             
  menu=0
  dir=""
  modif=""
  while [ $menu -ne 6 ]
  do
      echo "1. Name: $name"
      echo "2. Directory $dir"
      echo "3. Last modified: $modif"
      echo "4. Minimum size: $size"
      echo "5. Search"
      echo "6. End"
      read menu
      case "$menu" in
          "1") 
              read name 
              ;;
          "2") read dir ;;
          "3") read modif ;;
          "4") 
              read size
              ;;
          "5") 
              if [ -z $name ]
          then
              unset tablica[0]
          else    
              tablica[0]="-name $name"
          fi          
          find "${tablica[@]}"
          ;;
      "6") ;;
      *) echo "Wrong number!"
  esac
  done
  </code></pre>
  
  <p>But another error: </p>
  
  <p>find: unknown predicate `-name example.txt'</p>