title: Bash script: A better way to remove a list of files and directories with wildcards
body: <p>I am trying to pass a list of files including wildcard files and directories that I want to delete but check for them to see if they exist first before deleted. If they are deleted, notify that the directory was deleted, not each individual file within the directory. I.e. if I remove /root/*.tst just say, "I removed *.tst".</p>
  
  <pre><code>#!/bin/bash
  
  touch /boot/{1,2,3,4,5,6,7,8,9,10}.tst
  touch /root/{1,2,3,4,5,6,7,8,9,10}.tst
  mkdir /root/tmpdir
  
  #setup files and directories we want to delete
  file=/boot/*.tst /root/*.tst /root/tmpdir
  for i in $file; do
      if [[ -d "$file" || -f "$file" ]]; then #do I exist
          rm -fr $i
          echo removed $i #should tell me that I removed /boot/*.tst or /root/*.tst or /root/tmpdir
      else
          echo $i does not exist # should tell me if /boot/*.tst or /root/*.tst or /root/tmpdir DNE
      fi
  done
  </code></pre>
  
  <p>I can't seem to make any combination of single or double quotes or escaping * make the above do what I want it to do.</p>