From: Silvio Rhatto Date: Thu, 29 May 2014 18:27:38 +0000 (-0300) Subject: More mvln fixes X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=366f528621e7d577106aa71c162f1c7d1472d7db;p=scripts.git More mvln fixes --- diff --git a/mvln b/mvln index b79feab..ec4c359 100755 --- a/mvln +++ b/mvln @@ -8,16 +8,16 @@ # http://serverfault.com/questions/8108/move-a-file-and-leave-a-soft-link-behind # Parameters -ORIG="$1" -DEST="$2" BASE="$(basename "$1")" +ORIG="$(dirname "$1")" +DEST="$2" # Check -if [ ! -e "$1" ]; then - echo "File not found: $1" +if [ ! -e "$ORIG/$BASE" ]; then + echo "File not found: $ORIG/$BASE" exit 1 fi # Proceed mkdir -p "$DEST" -mv "$ORIG" "$DEST" && ln -s "$DEST/$BASE" "$ORIG" +mv "$ORIG/$BASE" "$DEST" && ln -s "$DEST/$BASE" "$ORIG/$BASE"