From 622c31c4894ffb215a3302949dcf0fab5d033e5d Mon Sep 17 00:00:00 2001 From: "committer@tuxwarrior" Date: Wed, 18 Mar 2026 08:39:56 -0500 Subject: [PATCH] smoother code, using a function for dir checking --- dots/bin/importGnupgKeys.sh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/dots/bin/importGnupgKeys.sh b/dots/bin/importGnupgKeys.sh index 20d6938..25ff543 100755 --- a/dots/bin/importGnupgKeys.sh +++ b/dots/bin/importGnupgKeys.sh @@ -2,21 +2,23 @@ # klevstul :: 24.06 :: docs: docs/gpg.md +dir_checker() { + dir=$1 + + if [ ! -d ${dir} ]; then + echo "error: missing directory '${dir}'" + exit 1 + fi +} + src_dir=/home/poq/syncDir/secrets/gnupg tmp_dir=/tmp this_file_name=`basename "$0"` echo "$this_file_name" -if [ ! -d ${src_dir} ]; then - echo "error: missing directory '${src_dir}'" - exit 1 -fi - -if [ ! -d ${tmp_dir} ]; then - echo "error: missing directory '${tmp_dir}'" - exit 1 -fi +dir_checker ${src_dir} +dir_checker ${tmp_dir} echo "please, remember the hint: bibL2"