Recently Written · git

tmpl

Insanely simple templates

git clone https://github.com/equwal/tmpl

Log | Files | Refs


sh/tree-exec (406 bytes)

1 # Alternative to find
2 # you can do better
3 myfind () {
4     cd -P -- "$1"
5     [ $# -lt 3 ] || [ "$PWD" = "$3" ] || exit 1
6     for i in ..?* .[!.]* * ; do
7     [ -e "$i" ] && eval "$2 \"\$i\"" # the subshell issue
8     [ -d "$i" ] && myfind "$i" "$2" "${PWD%/}/$i"
9     done
10 }
11 
12 # handler () { case "$1" in *~) [ -f "$1" ] && rm -f "$1" ;; esac ; }
13 # myfind /tmp handler   # Remove all backup files found in /tmp