From ce883f56c6285d25f0dc50584e39dbebff7a77f9 Mon Sep 17 00:00:00 2001 From: Christian Heller <c.heller@plomlompom.de> Date: Tue, 13 Nov 2018 23:24:32 +0100 Subject: [PATCH] Improve symlink script. --- all_new_2018/symlink_etc.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/all_new_2018/symlink_etc.sh b/all_new_2018/symlink_etc.sh index 9a7a162..edee563 100755 --- a/all_new_2018/symlink_etc.sh +++ b/all_new_2018/symlink_etc.sh @@ -14,7 +14,9 @@ fi config_tree_prefix="${HOME}/config/all_new_2018/linkable_etc_files/" cd "${config_tree_prefix}""${target}" for path in $(find . -type f); do - src=$(echo "${path}" | cut -c2-) - dest=$(realpath "${path}") - ln -fs "${dest}" "${src}" + linking=$(echo "${path}" | cut -c2-) + linked=$(realpath "${path}") + dir=$(dirname "${linking}") + mkdir -p "${dir}" + ln -fs "${linked}" "${linking}" done -- 2.30.2