mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-26 19:03:38 +08:00
Fix builtin $var expansion
A special case added for #1252 needed adjustment. Fixes #5639
This commit is contained in:
parent
1701e2c558
commit
038fea1a47
|
@ -1195,9 +1195,10 @@ static bool detect_errors_in_plain_statement(const wcstring &buff_src,
|
|||
|
||||
// Check that we don't do an invalid builtin (issue #1252).
|
||||
if (!errored && decoration == parse_statement_decoration_builtin &&
|
||||
!builtin_exists(command)) {
|
||||
expand_one(*unexp_command, 0, null_environment_t{}, parse_errors) &&
|
||||
!builtin_exists(*unexp_command)) {
|
||||
errored = append_syntax_error(parse_errors, source_start, UNKNOWN_BUILTIN_ERR_MSG,
|
||||
command.c_str());
|
||||
unexp_command->c_str());
|
||||
}
|
||||
}
|
||||
return errored;
|
||||
|
|
|
@ -9,6 +9,9 @@ $CMD1
|
|||
set CMD2 echo '(' not expanded again
|
||||
$CMD2
|
||||
|
||||
# Test using variables with the builtin decorator
|
||||
builtin $CMD1
|
||||
|
||||
# Test implicit cd
|
||||
set CMD3 /usr/bin
|
||||
$CMD3 && echo $PWD
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
basic command as variable
|
||||
( not expanded again
|
||||
basic command as variable
|
||||
/usr/bin
|
||||
|
|
Loading…
Reference in New Issue
Block a user