Explorar el Código

target parent must be a dir

Herby Vojčík hace 4 años
padre
commit
f1329214b4
Se han modificado 1 ficheros con 6 adiciones y 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"`