From 68c6fe6acfe3840e0facd368b47892006158319f Mon Sep 17 00:00:00 2001 From: Amber Date: Thu, 19 Nov 2020 12:35:11 +0100 Subject: [PATCH] command help --- .bashrc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.bashrc b/.bashrc index c28961f..5743407 100644 --- a/.bashrc +++ b/.bashrc @@ -139,11 +139,14 @@ gitpush() { } swp() { - if [ "$1"="-h" ]; then + myhelp() { echo 'This tool is usefull to remove .swp files' echo 'Usage: swp [-d dir] [-noi]' echo 'if you do not specify the directory in -d param, search starts from the current' echo 'if you do not specify the -noi param files removing is interactive' + } + if [ "$1" == '-h' ]; then + myhelp return 1 fi cpath=. @@ -166,12 +169,15 @@ swp() { } purgefext() { - if [ "$1"="-h" ]; then + myhelp() { echo 'This tool is usefull to remove specific files type' echo 'Usage: purgefext -e ext [-d dir] [-noi]' echo 'the e param is mandatory: is the files extension you want to remove' echo 'if you do not specify the directory in -d param, search starts from the current' echo 'if you do not specify the -noi param files removing is interactive' + } + if [ "$1" == '-h' ]; then + myhelp return 1 fi cpath=. @@ -192,6 +198,11 @@ purgefext() { esac shift #shift params done + + if [ "$ext" == '' ]; then + myhelp + return 1 + fi find $cpath -name "*."$ext -exec rm $interactive {} \; }