diff options
-rwxr-xr-x | mvln | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -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" |