summaryrefslogtreecommitdiff
path: root/Userland/Shell
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2021-03-15 11:25:20 +0330
committerAndreas Kling <kling@serenityos.org>2021-03-15 09:06:21 +0100
commit125be2923c26d7968809aada2b57a7313d1cd53b (patch)
tree2b3c4fef9119e874cdee94b945b43b0cea31ccdc /Userland/Shell
parentf59d58cb76e234664cd248f4971532d163a8a92e (diff)
downloadserenity-125be2923c26d7968809aada2b57a7313d1cd53b.zip
Shell: Consume the username when parsing '~user'
Otherwise it will stay there and be parsed as a juxtaposition. Fixes #5798.
Diffstat (limited to 'Userland/Shell')
-rw-r--r--Userland/Shell/Parser.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/Userland/Shell/Parser.cpp b/Userland/Shell/Parser.cpp
index c821400eb1..b35ac15ac9 100644
--- a/Userland/Shell/Parser.cpp
+++ b/Userland/Shell/Parser.cpp
@@ -1686,7 +1686,11 @@ RefPtr<AST::Node> Parser::parse_bareword()
restore_to(rule_start->offset, rule_start->line);
auto ch = consume();
VERIFY(ch == '~');
+ auto username_length = username.length();
tilde = create<AST::Tilde>(move(username));
+ // Consume the username (if any)
+ for (size_t i = 0; i < username_length; ++i)
+ consume();
}
if (string.is_empty())