check lnoptions
authorJoerg Jaspert <joerg@debian.org>
Mon, 4 Mar 2013 11:25:17 +0000 (12:25 +0100)
committerJoerg Jaspert <joerg@debian.org>
Mon, 4 Mar 2013 11:25:17 +0000 (12:25 +0100)
M .zsh/functions/udh

.zsh/functions/udh

index d1d756a..4aa58ff 100644 (file)
@@ -83,16 +83,21 @@ for entry in $workdirs[@]; do
         esac
     fi
 
+    LNOPTS="-s"
+    if ln --help 2>/dev/null | grep -- --relative >/dev/null; then
+        LNOPTS="${LNOPTS} --relative"
+    fi
+
     if [ -n "${dirn}" ]; then
         mkdir -p "${HOME}/${dirn}"
         if [ ! -L ${HOME}/${dirn}/${base} ]; then
             echo "Linking ${entry} to ${HOME}/${dirn}/${base}"
-            ln -rs ${entry} ${HOME}/${dirn}
+            ln ${LNOPTS} ${entry} ${HOME}/${dirn}
         fi
     else
         if [ ! -L ${HOME}/${dirn}/${base} ]; then
             echo "Linking ${entry} to ${HOME}/${dirn}"
-            ln -rs ${entry} ${HOME}/${base}
+            ln ${LNOPTS} ${entry} ${HOME}/${base}
         fi
     fi
 done