Spot the bug in the cleanup function

from Linux
Linux 7.2.3 intermediate 7 min 3 issues to find

Find the safety and correctness bugs in this generated cleanup function.

Shell
cleanup() {
  target=$1
  for file in $(find $target -type f -name '*.tmp'); do
    rm $file
  done
  echo "cleaned $target"
}
cleanup "$1"
Open in playground
Report an error