My dotfiles. Period.

mklinks 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/sh
  2. # ============================================
  3. # mklinks
  4. # --------------------------------------------
  5. # This script will go through each sub-folder
  6. # of DOTROOT and create symbolic link to it
  7. # under your HOME named with "." prefix.
  8. #
  9. # This is useful for sharing your dotfiles
  10. # (e.g. using service like Dropbox or keeping
  11. # them in a shared VCS repository like git)
  12. #
  13. # DOTROOT - path where your shared dot-files
  14. # are.
  15. # PREFIX - where you want your links to
  16. # dot-files to be created ($HOME
  17. # by default)
  18. #
  19. # --------------------------------------------
  20. # By Alois Mahdal; no warranty
  21. # ============================================
  22. if [ -z "$1" ];
  23. then echo "usage: $0: DOTROOT [PREFIX]";
  24. exit 1;
  25. fi;
  26. dotroot=$1
  27. prefix=$HOME
  28. if [ -n "$2" ];
  29. then prefix=$2;
  30. fi;
  31. ls $dotroot | while read item;
  32. do
  33. source=$dotroot/$item;
  34. target=$prefix/.$item;
  35. if [ -e $target ];
  36. then
  37. echo "target exists: $target" 1>&2;
  38. else
  39. ln -s $source $target;
  40. fi;
  41. done;