diff --git a/Userland/Shell/AST.cpp b/Userland/Shell/AST.cpp index 45dd80f8e7..f155304c6d 100644 --- a/Userland/Shell/AST.cpp +++ b/Userland/Shell/AST.cpp @@ -2363,7 +2363,9 @@ ErrorOr> MatchExpr::run(RefPtr shell) return move(result).get>(); } - shell->raise_error(Shell::ShellError::EvaluatedSyntaxError, "Non-exhaustive match rules!", position()); + // Non-exhaustive 'case' statements are valid in POSIX. + if (!shell || !shell->posix_mode()) + shell->raise_error(Shell::ShellError::EvaluatedSyntaxError, "Non-exhaustive match rules!", position()); return make_ref_counted({}); } diff --git a/Userland/Shell/Shell.h b/Userland/Shell/Shell.h index 2babf1a4ce..b4e7501c88 100644 --- a/Userland/Shell/Shell.h +++ b/Userland/Shell/Shell.h @@ -308,6 +308,8 @@ public: void notify_child_event(); + bool posix_mode() const { return m_in_posix_mode; } + struct termios termios; struct termios default_termios; bool was_interrupted { false };