#!/usr/bin/env bash
sources=("$PWD/config/" "$PWD/etc/" "$PWD/home/")
targets=("$HOME/.config/" "/etc/" "$HOME/")
length=${#sources[@]}

# TODO: need to address need to run as sudo to add symlink to certain folders, maybe ask in outer loop when sudo is needed and set a variable

for ((i = 0; i < length; i++)); do

  source=${sources[i]}
  target=${targets[i]}

  for folder in $(ls $source -a); do
    if [ -e "$target$folder" ]; then
      echo "The file '$target$folder' exists."
    else
      ln -s $source$folder $target$folder
    fi
  done
done
