From: Silvio Rhatto Date: Thu, 29 May 2014 18:23:30 +0000 (-0300) Subject: Using parameters at mvln X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=b04072ea1c6979f17305ce3583dad347e2044dda;p=scripts.git Using parameters at mvln --- diff --git a/mvln b/mvln index 17ff47c..b79feab 100755 --- 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"