清理前先提示,确认后再执行清理 #!/bin/bash read -r -p "Are You Sure to run clear? [Y/n] " input case $input in [yY]) echo "clearing..." ;; *) echo "exit,bye bye" exit 1 ;; esac cd ~ find . -name '.DS_Store'|xargs rm -rf cd /Users/dugang/tmp rm -rf * cd /Users/dugang/Downloads rm -rf * echo "clear done"