]> gitweb.fluxo.info Git - scripts.git/commitdiff
More mvln fixes
authorSilvio Rhatto <rhatto@riseup.net>
Thu, 29 May 2014 18:27:38 +0000 (15:27 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Thu, 29 May 2014 18:27:38 +0000 (15:27 -0300)
mvln

diff --git a/mvln b/mvln
index b79feab744657705840cdacca004c4a87f7b1136..ec4c359b98406348583fccdcd196a02f89c65f03 100755 (executable)
--- 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"