2021-08-14 18:01:30 +09:00
|
|
|
#!/bin/bash
|
|
|
|
set -euo pipefail
|
2022-04-22 19:47:02 +09:00
|
|
|
cd -- "$(dirname -- "$0")"
|
2021-08-14 18:01:30 +09:00
|
|
|
|
2022-04-25 19:28:26 +09:00
|
|
|
function main() {
|
2022-04-25 19:39:57 +09:00
|
|
|
local home
|
2022-04-25 19:28:26 +09:00
|
|
|
local dotfile
|
2022-04-25 19:39:57 +09:00
|
|
|
home=$(eval echo ~"${SUDO_USER:-$(id -un)}")
|
2022-04-25 19:28:26 +09:00
|
|
|
for dotfile in .*; do
|
|
|
|
[[ $dotfile =~ ^(\.\.?|\.git)$ ]] && continue
|
2021-08-14 18:01:30 +09:00
|
|
|
|
2022-04-25 19:28:26 +09:00
|
|
|
dotfile=$(realpath "$dotfile")
|
|
|
|
(
|
2022-04-25 19:39:57 +09:00
|
|
|
cd -- "$home"
|
2022-04-25 19:28:26 +09:00
|
|
|
ln -svf "$dotfile" .
|
|
|
|
)
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
main
|