From b5a2566b6374c64d8edc494757dfaa57f9e30bf1 Mon Sep 17 00:00:00 2001 From: Amber Date: Tue, 17 Nov 2020 10:57:44 +0100 Subject: [PATCH] purge fext --- .bashrc | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/.bashrc b/.bashrc index 1368e46..cfd0a03 100644 --- a/.bashrc +++ b/.bashrc @@ -139,9 +139,49 @@ gitpush() { } swp() { - find ${1-~} -name *.swp -exec rm -i {} \; + cpath=. + interactive='-i' + while [ -n "$1" ]; do # while loop starts + case "$1" in + -noi) interactive='';; + -d) if [[ -d "$2" ]]; then + cpath="$2" + else + echo Folder "$2" not exists + fi + shift;; + *) echo "Option $1 not recognized" ;; + esac + shift #shift params + done + + find $cpath -name "*."swp -exec rm "$interactive" {} \; } +purgefext() { + cpath=. + interactive='-i' + ext='' + while [ -n "$1" ]; do # while loop starts + case "$1" in + -noi) interactive='';; + -d) if [[ -d "$2" ]]; then + cpath="$2" + else + echo Folder "$2" not exists + fi + shift;; + -e) ext="$2" + shift;; + *) echo "Option $1 not recognized" ;; + esac + shift #shift params + done + + find $cpath -name "*."$ext -exec rm $interactive {} \; +} + + man() { env \ LESS_TERMCAP_mb=$(printf "\e[1;31m") \