diff --git a/Userland/Shell/AST.cpp b/Userland/Shell/AST.cpp index 54850e0cab..fc7e836245 100644 --- a/Userland/Shell/AST.cpp +++ b/Userland/Shell/AST.cpp @@ -1425,6 +1425,10 @@ ErrorOr Heredoc::dump(int level) const ErrorOr> Heredoc::run(RefPtr shell) { + if (shell && shell->posix_mode() && !m_contents) { + m_contents = make_ref_counted(position(), ""_string, StringLiteral::EnclosureType::None); + } + if (!m_contents) { if (shell) shell->raise_error(Shell::ShellError::EvaluatedSyntaxError, "Attempt to evaluate an unresolved heredoc"sv, position());