From 72e40714b9c211e4cac1b5463bb62b80cb6408b2 Mon Sep 17 00:00:00 2001 From: Rasmus Steinke Date: Tue, 30 Aug 2016 17:37:39 +0200 Subject: [PATCH] properly check for user config --- buku_run | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/buku_run b/buku_run index 1454212..d33a011 100755 --- a/buku_run +++ b/buku_run @@ -13,10 +13,29 @@ actions="Alt+a" help_color="#334433" # source global config -source /etc/buku.config +if [[ -f /etc/buku_run.config ]] +then + source /etc/buku_run.config +fi # source local config: -source $HOME/.config/buku_run/config +if [[ -z $XDG_CONFIG_DIR ]] +then + if [[ -f $HOME/.config/buku_run/config ]] + then + source $HOME/.config/buku_run/config + else + echo "User config file \'~/.config/buku_run/config\' not found. using global config" + fi +else + if [[ -f "${XDG_CONFIG_DIR}/buku_run/config" ]] + then + source "${XDG_CONFIG_DIR}/buku_run/config" + else + echo "User config file \'~/.config/buku_run/config\' not found. using global config" + fi +fi + main () { HELP="Welcome to Buku. Use ${new_bookmark} to add a new Bookmark