aboutsummaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorYuchen Pei <id@ypei.org>2024-05-26 15:02:54 +1000
committerYuchen Pei <id@ypei.org>2024-05-26 15:02:54 +1000
commit8976fd48fce00cb627e61e93680a5f891df5f8fd (patch)
tree4d5c7daa3e744ab42121da7fc040b79c76e10364 /misc
parent112596afc9c185f5b4ce81cd85f6d89794a8c947 (diff)
[bash] check for local file and functions before sourcing and calling
Diffstat (limited to 'misc')
-rw-r--r--misc/.bashrc16
1 files changed, 12 insertions, 4 deletions
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