summaryrefslogtreecommitdiff
path: root/src/os_unix.c
diff options
context:
space:
mode:
authorChristian Brabandt <cb@256bit.org>2021-11-19 12:37:36 +0000
committerBram Moolenaar <Bram@vim.org>2021-11-19 12:37:36 +0000
commit8b8d829faf04fe3706c04f7f7000054acd3254e7 (patch)
tree10c4d21070962f5b95eb1acb235d519e812f5f82 /src/os_unix.c
parent64be6aa3a54ecfe355d4a03e1200650c301e7f29 (diff)
downloadvim-git-8b8d829faf04fe3706c04f7f7000054acd3254e7.tar.gz
patch 8.2.3623: "$*" is expanded to "nonomatch"v8.2.3623
Problem: "$*" is expanded to "nonomatch". Solution: Only add "set nonomatch" when using a csh-like shell. (Christian Brabandt, closes #9159, closes #9153)
Diffstat (limited to 'src/os_unix.c')
-rw-r--r--src/os_unix.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index 0b2b5725e..fa9c5f392 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -6691,10 +6691,17 @@ mch_expand_wildcards(
}
else
{
- if (flags & EW_NOTFOUND)
- STRCPY(command, "set nonomatch; ");
- else
- STRCPY(command, "unset nonomatch; ");
+ STRCPY(command, "");
+ if (shell_style == STYLE_GLOB)
+ {
+ // Assume the nonomatch option is valid only for csh like shells,
+ // otherwise, this may set the positional parameters for the shell,
+ // e.g. "$*".
+ if (flags & EW_NOTFOUND)
+ STRCAT(command, "set nonomatch; ");
+ else
+ STRCAT(command, "unset nonomatch; ");
+ }
if (shell_style == STYLE_GLOB)
STRCAT(command, "glob >");
else if (shell_style == STYLE_PRINT)