Source

dotfiles / setup_links.sh

Diff from to

File setup_links.sh

 echo "Linking from: $LINK_DIR"
 echo "Linking to: $HOME"
 
+OS=`uname -s`
+
+if [ $OS == "Darwin" ]; then
+    LN="ln -ins"
+else
+    LN="ln --backup=numbered -ns"
+fi
+
+# let's get down to business -
+# fail on errors / undefined values
+set -e -u
+
 for file in $LINK_DIR/*
 do
-    echo "ln --backup=numbered -ns $file ~/.$(basename $file)"
-    ln --backup=numbered -ns $file ~/.$(basename $file)
+    case $file in
+        *.symlink)
+            fname=`echo $file | sed -e 's/^.*\///' -e 's/.symlink$//'`
+            echo "linking $file to ~/.$fname"
+            $LN $file ~/.$fname
+            ;;
+        *)
+            ;;
+    esac
 done