From edbae7770ab84a9ad744ff202b3381b2ed91b2d3 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Fri, 22 Sep 2023 19:45:16 +0200 Subject: [PATCH] only enable globstar setting, if bash version is larger 4 --- src/os_unix.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/os_unix.c b/src/os_unix.c index a637a37948f31..6248336960176 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -6703,15 +6703,15 @@ mch_expand_wildcards( #define STYLE_PRINT 3 // use "print -N", for zsh #define STYLE_BT 4 // `cmd` expansion, execute the pattern directly #define STYLE_GLOBSTAR 5 // use extended shell glob for bash (this uses extended - // globbing functionality using globstar) + // globbing functionality using globstar, needs bash > 4) int shell_style = STYLE_ECHO; int check_spaces; static int did_find_nul = FALSE; int ampersand = FALSE; // vimglob() function to define for Posix shell static char *sh_vimglob_func = "vimglob() { while [ $# -ge 1 ]; do echo \"$1\"; shift; done }; vimglob >"; - // globstar() function with globstar setting enabled - static char *sh_globstar_opt = "shopt -s globstar; "; + // vimglob() function with globstar setting enabled, only for bash >= 4.X + static char *sh_globstar_opt = "[[ ${BASH_VERSINFO[0]} -ge 4 ]] && shopt -s globstar; "; *num_file = 0; // default: no files found *file = NULL;