Skip to content

Commit 1edf887

Browse files
ebadenesCopilot
andcommitted
fix(install): use $EUID builtin for root detection
Replace $(id -u) with ${EUID:-$(id -u)} for more reliable root detection in bash, falling back to id -u if EUID is not set. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 6cc59bf commit 1edf887

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ if [ -z "$unzip_tool" ]; then
5252
fi
5353

5454
# Determine install directory based on whether we are root or not
55-
if [ "$(id -u)" -ne 0 ]; then
55+
if [ "${EUID:-$(id -u)}" -ne 0 ]; then
5656
printf "\nYou are not running as root.\n"
5757
printf "Install eclone to ~/.local/bin instead of /usr/bin? [Y/n] "
5858
read -r answer </dev/tty

0 commit comments

Comments
 (0)