From 1bb74bf6c6ccbb0a2fd72e823ac73fff4f316408 Mon Sep 17 00:00:00 2001 From: Santiago Lo Coco Date: Tue, 21 Dec 2021 17:56:56 -0300 Subject: [PATCH] Add linkFiles.sh --- linkFiles.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 linkFiles.sh diff --git a/linkFiles.sh b/linkFiles.sh new file mode 100755 index 0000000..257dbc7 --- /dev/null +++ b/linkFiles.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +DOTFILES_HOME=$(pwd -P) +DOTFILES_CONFIG="$(pwd -P)/.config" + +for src in $(find -H "$DOTFILES_HOME" -not -path '*.git*' -not -path '*.config*' -not -path '*.ssh*' -not -path '*.icons*'); do + if [ "$(basename "${src}")" = "CocoRice" ]; then + continue + fi + + #echo "$src" + #echo "$HOME/test/$(basename "${src}")" + ln -s "$src" "$HOME/test/$(basename "${src}")" +done + + +for src in $(find -H "$DOTFILES_CONFIG"); do + if [[ -d "$src" ]]; then + var=$(echo "$src" | awk '{ sub(/.*CocoRice\//, ""); print }') + if [[ ! -d "$HOME/test/$var" ]]; then + echo "$HOME/test/$var" "doesn't exists" + mkdir -p "$HOME/test/$var" + fi + fi + + if [[ -f "$src" ]]; then + #awk '{ sub(/.*CocoRice\//, ""); print }' <<< "$src" + var=$(echo "$src" | awk '{ sub(/.*CocoRice\//, ""); print }') + ln -s "$src" "$HOME/test/$var" + fi +done