diff --git a/zsh/.config/zsh/config.d/00_detect_remote.zsh b/zsh/.config/zsh/config.d/00_detect_remote.zsh index 827620c..b1f4e7a 100644 --- a/zsh/.config/zsh/config.d/00_detect_remote.zsh +++ b/zsh/.config/zsh/config.d/00_detect_remote.zsh @@ -2,9 +2,11 @@ # processes of this shell and checking for things like sshd/tailscaled. Runs # first because multiple other things rely on this. -is_remote="" -proctree="$(pstree -s $$)" -echo "$proctree" | grep "sshd" && is_remote="$is_remote sshd" -echo "$proctree" | grep "tailscaled" && is_remote="$is_remote tailscaled" +declare -a is_remote +is_remote=() -[ -n "$is_remote" ] && export IS_REMOTE_SESSION="$(echo $is_remote | xargs)" +proctree="$(pstree -s $$)" +[[ "$proctree" =~ sshd ]] && is_remote+=sshd +[[ "$proctree" =~ tailscaled ]] && is_remote+=tailscaled + +[ -n "$is_remote" ] && export IS_REMOTE_SESSION="$is_remote[@]"