From bd52bca0e23170ff3b08f04920b9cc2264760c0e Mon Sep 17 00:00:00 2001 From: Matteo Cypriani Date: Wed, 11 Apr 2018 20:59:48 +0200 Subject: [PATCH] mvparent: reindent with 4 spaces --- file_utils/mvparent.sh | 48 ++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/file_utils/mvparent.sh b/file_utils/mvparent.sh index 10a04be..79c64c4 100755 --- a/file_utils/mvparent.sh +++ b/file_utils/mvparent.sh @@ -11,38 +11,40 @@ # Moves the contents of the given directory into its parent directory. if [ $# -lt 1 ] ; then - echo "Usage: `basename $0` DIRECTORY [DIRECTORY [...]]" >&2 - exit 1 + echo "Usage: `basename $0` DIRECTORY [DIRECTORY [...]]" >&2 + exit 1 fi while [ "$1" != "" ] ; do - REP="$1" - shift + REP="$1" + shift - if [ ! -d "$REP" ] ; then - echo "Warning! \"$REP\" is not a directory: ignoring." >&2 - continue - fi + if [ ! -d "$REP" ] ; then + echo "Warning! \"$REP\" is not a directory: ignoring." >&2 + continue + fi - TARGET=$(basename "$REP") - REP=$(dirname "$REP") + TARGET=$(basename "$REP") + REP=$dirname "$REP") - if [ "$TARGET" = "." -o "$TARGET" = ".." ] ; then - echo "Target cannot end by « . » or « .. »!" >&2 - exit 2 - fi + if [ "$TARGET" = "." -o "$TARGET" = ".." ] ; then + echo "Target cannot end by « . » or « .. »!" >&2 + exit 2 + fi - echo "Moving the contents of « $REP/$TARGET » into « $REP »..." >&2 + echo "Moving the contents of « $REP/$TARGET » into « $REP »..." >&2 - cd "$REP" + cd "$REP" - if [ "$(echo "$TARGET"/*)" != "$TARGET/*" ] ; then - mv -n "$TARGET"/* . - fi + if [ "$(echo "$TARGET"/*)" != "$TARGET/*" ] ; then + mv -n "$TARGET"/* . + fi - if [ "$(echo "$TARGET"/.[!.]*)" != "$TARGET/.[!.]*" ] ; then - mv -n "$TARGET"/.[!.]* . - fi + if [ "$(echo "$TARGET"/.[!.]*)" != "$TARGET/.[!.]*" ] ; then + mv -n "$TARGET"/.[!.]* . + fi - rmdir "$TARGET" + rmdir "$TARGET" done + +# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4