From 74b2549c68d6814f6fb5cea78e6082928c067d02 Mon Sep 17 00:00:00 2001 From: Kohei Watanabe Date: Mon, 25 Apr 2022 19:39:57 +0900 Subject: [PATCH] support sudo --- install | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/install b/install index b8f4c79..e0efebd 100755 --- a/install +++ b/install @@ -3,13 +3,15 @@ set -euo pipefail cd -- "$(dirname -- "$0")" function main() { + local home local dotfile + home=$(eval echo ~"${SUDO_USER:-$(id -un)}") for dotfile in .*; do [[ $dotfile =~ ^(\.\.?|\.git)$ ]] && continue dotfile=$(realpath "$dotfile") ( - cd + cd -- "$home" ln -svf "$dotfile" . ) done