From b61d021abdf0987960022ca6999549ef33ce9681 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Wed, 18 Jul 2018 22:15:35 +0200 Subject: [PATCH] Simplify detect_virt segment --- powerlevel9k.zsh-theme | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 144b4df4..2e645f0a 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -1046,18 +1046,14 @@ prompt_history() { ################################################################ # Detection for virtualization (systemd based systems only) prompt_detect_virt() { - if ! command -v systemd-detect-virt > /dev/null; then - return - fi - local virt=$(systemd-detect-virt) + local virt=$(systemd-detect-virt 2> /dev/null) if [[ "$virt" == "none" ]]; then if [[ "$(ls -di / | grep -o 2)" != "2" ]]; then virt="chroot" - "$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR" "yellow" "$virt" - else - ; fi - else + fi + + if [[ -n "${virt}" ]]; then "$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR" "yellow" "$virt" fi }