diff --git a/cpu.sh b/cpu.sh index 1c547d7..96bb48d 100755 --- a/cpu.sh +++ b/cpu.sh @@ -77,10 +77,12 @@ for VM in ${OUT}; do fi done -SEEN=$(ls -1 /tmp/vm* | awk -F'/' '{print $3}') -for s in ${SEEN[@]}; do - if [[ "${OUT[*]}" != *"${s}"* ]]; then - if [ -n "${DEBUG}" ]; then echo "${s} - remove from tracking list"; fi - rm -rf /tmp/${s} - fi -done +if ls /tmp/vm* 1> /dev/null 2>&1; then + SEEN=$(ls -1 /tmp/vm* | awk -F'/' '{print $3}') + for s in ${SEEN[@]}; do + if [[ "${OUT[*]}" != *"${s}"* ]]; then + if [ -n "${DEBUG}" ]; then echo "${s} - remove from tracking list"; fi + rm -rf /tmp/${s} + fi + done +fi