home · contact · privacy
Improve symlink script.
authorChristian Heller <c.heller@plomlompom.de>
Tue, 13 Nov 2018 22:24:32 +0000 (23:24 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 13 Nov 2018 22:24:32 +0000 (23:24 +0100)
all_new_2018/symlink_etc.sh

index 9a7a162f07c28b137fe1186ffe189b34af7904d2..edee563182d1d02fa3b320bb5bca4dd4e0a0fec8 100755 (executable)
@@ -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