Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if [ -z "$1" ]; then
- echo "Usage: $0 <filename-fraction>"
- exit 1
- fi
- FILES=$(find -maxdepth 1 -name "*$1*" -print0)
- echo $FILES
- read -p "Delete these files / directories? [no]: " ANS
- if [[ "$ANS" =~ [yY][eE][sS] ]]; then
- while IFS= read -r -d '' f; do
- ### rm -rf $f
- echo $f
- done <<< "$FILES"
- fi
- ==============
- Működő verzió:
- ==============
- if [ -z "$1" ]; then
- echo "Usage: $0 <filename-fraction>"
- exit 1
- fi
- IFS=$'\0'
- FILES=$(find -maxdepth 1 -name "*$1*")
- [[ -z "$FILES" ]] && exit 0
- echo "$FILES"
- read -p "Delete these files / directories? [no]: " ANS
- if [[ "$ANS" =~ [yY][eE][sS] ]]; then
- while read -r f; do
- rm -rf $f
- done <<< "$FILES"
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement