修复递归问题

Signed-off-by: shenmo <jifengshenmo@outlook.com>
This commit is contained in:
2025-06-04 15:30:40 +00:00
committed by Gitee
parent 6246cf3c98
commit 51b30d0ef7
2 changed files with 3 additions and 2 deletions

View File

@@ -25,7 +25,7 @@ HERE="$(dirname $(realpath $0))"
function get_current_user() {
# 优先通过 who 命令获取用户
local user
user=$(get_current_user 2>/dev/null)
user=$(who | awk '{print $1}' | head -n 1 2>/dev/null)
# 如果 who 无输出,则通过 loginctl 获取
if [[ -z "$user" ]]; then