aboutsummaryrefslogtreecommitdiff
path: root/mvln
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-05-29 15:27:38 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-05-29 15:27:38 -0300
commit366f528621e7d577106aa71c162f1c7d1472d7db (patch)
tree667ff5086bafcdf88046b6106ba1a360456839b2 /mvln
parentb04072ea1c6979f17305ce3583dad347e2044dda (diff)
downloadscripts-366f528621e7d577106aa71c162f1c7d1472d7db.tar.gz
scripts-366f528621e7d577106aa71c162f1c7d1472d7db.tar.bz2
More mvln fixes
Diffstat (limited to 'mvln')
-rwxr-xr-xmvln10
1 files changed, 5 insertions, 5 deletions
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"