From 94ec834c719ae76687509b49680c381c51ce30cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gregor=20B=C3=BCckendorf?= Date: Thu, 13 Dec 2018 11:16:07 +0100 Subject: [PATCH] bashrc: added a check for bash version 4 or newer --- .bashrc | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.bashrc b/.bashrc index b8b5964..6d2f65a 100644 --- a/.bashrc +++ b/.bashrc @@ -1,11 +1,19 @@ # .bashrc - # Source global definitions if [[ -r /etc/bashrc ]]; then . /etc/bashrc fi -# Source .bashrc.d -for file in ~/.bashrc.d/*.bashrc; do - . "$file" -done +# Bash 4 or bust +if (( BASH_VERSINFO[0] < 4 )); then + echo "Please get a newer version of Bash." + echo "Your bashrc won't work otherwise." +else + # Source .bashrc.d + for file in ~/.bashrc.d/*.bashrc; do + . "$file" + done + + unset -v file +fi +