]> gitweb.fluxo.info Git - scripts.git/commitdiff
Using parameters at mvln
authorSilvio Rhatto <rhatto@riseup.net>
Thu, 29 May 2014 18:23:30 +0000 (15:23 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Thu, 29 May 2014 18:23:30 +0000 (15:23 -0300)
mvln

diff --git a/mvln b/mvln
index 17ff47cac78296db89fb8e16c13e5974e1973bd1..b79feab744657705840cdacca004c4a87f7b1136 100755 (executable)
--- a/mvln
+++ b/mvln
@@ -7,6 +7,11 @@
 #     https://stackoverflow.com/questions/9251818/bash-move-file-directory-and-create-a-link-of-it
 #     http://serverfault.com/questions/8108/move-a-file-and-leave-a-soft-link-behind
 
+# Parameters
+ORIG="$1"
+DEST="$2"
+BASE="$(basename "$1")"
+
 # Check
 if [ ! -e "$1" ]; then
   echo "File not found: $1"
@@ -14,5 +19,5 @@ if [ ! -e "$1" ]; then
 fi
 
 # Proceed
-mkdir -p `dirname "$2"`
-mv "$1" "$2" && ln -s "$2/`dirname $1`" "$1"
+mkdir -p "$DEST"
+mv "$ORIG" "$DEST" && ln -s "$DEST/$BASE" "$ORIG"