diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2014-05-29 15:23:30 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2014-05-29 15:23:30 -0300 |
commit | b04072ea1c6979f17305ce3583dad347e2044dda (patch) | |
tree | d6cbc5d4d7710af5d3d72deaf49d4c42096e0b81 /mvln | |
parent | ece85f425d2415d179a88ff8a8d04ec4a9ced920 (diff) | |
download | scripts-b04072ea1c6979f17305ce3583dad347e2044dda.tar.gz scripts-b04072ea1c6979f17305ce3583dad347e2044dda.tar.bz2 |
Using parameters at mvln
Diffstat (limited to 'mvln')
-rwxr-xr-x | mvln | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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" |