From 986130d9ea655f334850424f7c6dfe02c9999a39 Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur Date: Thu, 21 Sep 2023 02:36:53 +0330 Subject: [PATCH] Shell: Accept IoNumber as a valid redirection target --- Userland/Shell/PosixParser.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Userland/Shell/PosixParser.cpp b/Userland/Shell/PosixParser.cpp index 8db4d3ce485..574dd129c45 100644 --- a/Userland/Shell/PosixParser.cpp +++ b/Userland/Shell/PosixParser.cpp @@ -2073,7 +2073,16 @@ ErrorOr> Parser::parse_io_file(AST::Position start_position, O auto io_operator_token = consume(); - auto word = TRY(parse_word()); + RefPtr word; + if (peek().type == Token::Type::IoNumber) { + auto token = consume(); + word = make_ref_counted( + token.position.value_or(empty_position()), + token.value); + } else { + word = TRY(parse_word()); + } + if (!word) { m_token_index = start_index; return nullptr;