diff --git a/Userland/Shell/PosixParser.cpp b/Userland/Shell/PosixParser.cpp index 615cf3afca..9eeab54583 100644 --- a/Userland/Shell/PosixParser.cpp +++ b/Userland/Shell/PosixParser.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #define TRY_OR_THROW_PARSE_ERROR_AT(expr, position) ({ \ @@ -23,6 +24,13 @@ _value_or_error.release_value(); \ }) +static RefPtr strip_execute(RefPtr node) +{ + while (node && node->is_execute()) + node = static_ptr_cast(node)->command(); + return node; +} + static Shell::AST::Position empty_position() { return { 0, 0, { 0, 0 }, { 0, 0 } }; @@ -1674,9 +1682,7 @@ ErrorOr> Parser::parse_word() '?'); break; case ResolvedParameterExpansion::Op::GetPositionalParameterListAsString: - node = make_ref_counted( - token.position.value_or(empty_position()), - "$* not implemented"_string); + node = strip_execute(::Shell::Parser { "${join \"${defined_value_or_default IFS ' '}\" $*}"sv }.parse()); break; case ResolvedParameterExpansion::Op::GetShellProcessId: node = make_ref_counted(