Browse Source

target parent must be a dir

Herby Vojčík 4 years ago
parent
commit
f1329214b4
1 changed files with 6 additions and 0 deletions
  1. 6 0
      mvdir.sh

+ 6 - 0
mvdir.sh

@@ -20,6 +20,12 @@ if [ -f "$2" -a ! -L "$2" ]; then
 fi
 
 TARGET_DIR_TMP=`dirname "$2"`
+
+if [ ! -d "$TARGET_DIR_TMP" ]; then
+  echo "$TARGET_DIR_TMP" must be a directory >&2
+  exit 3
+fi
+
 TARGET_DIR=`realpath "$TARGET_DIR_TMP"`
 TARGET_BASE=`basename "$2"`