From f616c7c691a074e0c2f99d99346197412d1a7295 Mon Sep 17 00:00:00 2001 From: Valentin Gehrke Date: Thu, 8 Oct 2015 17:42:26 +0200 Subject: [PATCH] Updated dotstow.sh --- dotstow.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/dotstow.sh b/dotstow.sh index c619f95..435ff41 100755 --- a/dotstow.sh +++ b/dotstow.sh @@ -1,5 +1,21 @@ #!/bin/bash +if [ -z "$(which realpath)" ]; then + realpath() { + path=$1 + if [ "${path[0]}" == "/" ]; then + echo $path; + elif [ "${path[0]}" == "~" ]; then + echo $HOME/${path:2} + elif [ "${path:0:2}" == ".." ]; then + echo $(dirname $(pwd))/${path:3} + else + echo $(pwd)/$path + fi + } +fi + + stow() { local stowrepo=$1 local stowtarget=$2