From 8976fd48fce00cb627e61e93680a5f891df5f8fd Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Sun, 26 May 2024 15:02:54 +1000 Subject: [bash] check for local file and functions before sourcing and calling --- misc/.bashrc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'misc') diff --git a/misc/.bashrc b/misc/.bashrc index 11b805d..115dab5 100644 --- a/misc/.bashrc +++ b/misc/.bashrc @@ -18,7 +18,9 @@ _checkexec () } # Machine-specific and personal settings -source ~/.bashrc_local +if [[ -f ~/.bashrc_local ]]; then + source ~/.bashrc_local +fi ## prompts # git prompt @@ -63,7 +65,9 @@ then fi # from ~/.bashrc_local, adding more to PATH -my_local_add_path +if [[ $(type -t my_local_add_path) == function ]]; then + my_local_add_path +fi export PATH @@ -192,7 +196,9 @@ then fi # from ~/.bashrc_local, more aliases -my_local_aliases +if [[ $(type -t my_local_aliases) == function ]]; then + my_local_aliases +fi #ibus export GTK_IM_MODULE=ibus @@ -222,4 +228,6 @@ export CCACHE_EXEC=/usr/bin/ccache export CVS_RSH="ssh" # from ~/.bashrc_local, export more stuff -my_local_export +if [[ $(type -t my_local_export) == function ]]; then + my_local_export +fi -- cgit v1.2.3