From bec3e8654fcff7d3af25e31eb9543913358f18e6 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Sat, 24 Aug 2024 17:13:50 +0300 Subject: [PATCH] Shell: Implement escaping quotes in quoted strings --- userspace/programs/Shell/main.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/userspace/programs/Shell/main.cpp b/userspace/programs/Shell/main.cpp index a61a673e..3e5c0615 100644 --- a/userspace/programs/Shell/main.cpp +++ b/userspace/programs/Shell/main.cpp @@ -197,6 +197,18 @@ BAN::Vector> parse_command(BAN::StringView command_view { char c = command_view[i]; + if (i + 1 < command_view.size() && c == '\\') + { + char next = command_view[i + 1]; + if (next == '\'' || next == '"') + { + if (i + 1 < command_view.size()) + MUST(current_arg.push_back(next)); + i++; + continue; + } + } + switch (state) { case State::Normal: