Explorar o código

target parent must be a dir

Herby Vojčík %!s(int64=6) %!d(string=hai) anos
pai
achega
f1329214b4
Modificáronse 1 ficheiros con 6 adicións e 0 borrados
  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"`