From e15c58dfd709f80a2416384b86a68671d84d3ed4 Mon Sep 17 00:00:00 2001 From: Narrat Date: Sun, 7 Jan 2018 20:53:20 +0100 Subject: [PATCH] list_gnupg_ciphers: Pipe everything into /dev/null Firstly the printed binary path is in the wrong place. Reading the text, one assumes Ciphers coming next. Secondly it doesn't make sense to check there for a missing gnupg installation. Before calling list_gnupg_ciphers(), there is a direct call for gpg --version. If that fails the whole text is scrambled and no error reported Dropping the output from which allows to remove the space from printing the ciphers. The text is correctly aligned now --- tomb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tomb b/tomb index 1d7585c..771007c 100755 --- a/tomb +++ b/tomb @@ -1360,7 +1360,7 @@ gen_key() { # prints an array of ciphers available in gnupg (to encrypt keys) list_gnupg_ciphers() { # prints an error if GnuPG is not found - which gpg 2>/dev/null || _failure "gpg (GnuPG) is not found, Tomb cannot function without it." + which gpg &>/dev/null || _failure "gpg (GnuPG) is not found, Tomb cannot function without it." ciphers=(`gpg --version | awk ' BEGIN { ciphers=0 } @@ -1368,7 +1368,7 @@ BEGIN { ciphers=0 } /^Hash:/ { ciphers=0 } { if(ciphers==0) { next } else { gsub(/,/,""); print; } } '`) - print " ${ciphers}" + print "${ciphers}" return 1 }