Skip to content

Commit

Permalink
rmd: skip non-directories
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorgorjanc committed Mar 15, 2018
1 parent f3ec522 commit a5350ee
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions func_rm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,18 @@ EOF
rmMap()
{
if [ -e "$1" ]; then
rm -Rf "$1"
if [ -e "$1" ]; then
echo "Directory $1 not removed. Something went wrong!"
elif [ -n "$2" -a "$2" = "yes" ]; then
mkdir "$1"
echo "Directory $1 cleaned. "
if [ -d "$1" ]; then
rm -Rf "$1"
if [ -e "$1" ]; then
echo "Directory $1 not removed. Something went wrong! "
elif [ -n "$2" -a "$2" = "yes" ]; then
mkdir "$1"
echo "Directory $1 cleaned. "
else
echo "Directory $1 removed. "
fi
else
echo "Directory $1 removed. "
echo "$1 is not a directory. Skipped! "
fi
else
echo "Directory $1 doesn't exist. "
Expand Down

0 comments on commit a5350ee

Please sign in to comment.