From 1446cc99486f495426bdcfae76253204f0c9d4a8 Mon Sep 17 00:00:00 2001 From: gurkenhabicht Date: Mon, 9 Feb 2026 15:27:53 +0100 Subject: [PATCH] error handling for ssh-host function --- bash/.bash_functions | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bash/.bash_functions b/bash/.bash_functions index 8c19812..975be4a 100644 --- a/bash/.bash_functions +++ b/bash/.bash_functions @@ -11,8 +11,12 @@ ssh() { # Use fzf to find all your configured ssh connection ssh-host() { - ssh $(cat "$HOME/.ssh/config" "$HOME/.ssh/conf.d/individual_user" \ - | awk '$1 == "Host" && $2 != "*" {print $2}' | fzf --reverse) + if [ "$(which fzf 2>/dev/null)" ]; then + ssh $(cat "$HOME/.ssh/config" "$HOME/.ssh/conf.d/individual_user" \ + | awk '$1 == "Host" && $2 != "*" {print $2}' | fzf --reverse) + else + echo "fzf not installed!" + fi } # Creates a new directory and immediately changes into it