From 67289cc183714676ad711fd4292f527b1821f0ec Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Mon, 2 Jul 2012 16:04:55 +0200 Subject: Enable some Bash 4 features when possible: - `autocd` - Recursive globbing --- .bash_profile | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to '.bash_profile') diff --git a/.bash_profile b/.bash_profile index cfb020b..31efec5 100644 --- a/.bash_profile +++ b/.bash_profile @@ -14,6 +14,16 @@ shopt -s histappend # Autocorrect typos in path names when using `cd` shopt -s cdspell +# Enable some Bash 4 features when possible: +# * `autocd`, e.g. `**/qux` will enter `./foo/bar/baz/qux` +# * Recursive globbing, e.g. `echo **/*.txt` +for option in autocd globstar; do + tmp="$(shopt -q "$option" 2>&1 > /dev/null | grep "invalid shell option name")" + if [ '' == "$tmp" ]; then + shopt -s "$option" + fi +done + # Prefer US English and use UTF-8 export LC_ALL="en_US.UTF-8" export LANG="en_US" -- cgit v1.2.3