Kernel: Implement shebang executables ("#!/bin/sh")

This patch makes it possible to *run* text files that start with the
characters "#!" followed by an interpreter.

I've tested this with both the Serenity built-in shell and the Bash
shell, and it works as expected. :^)
This commit is contained in:
Andreas Kling 2019-09-15 11:47:21 +02:00
commit 85d629103d
Notes: sideshowbarker 2024-07-19 12:06:26 +09:00
2 changed files with 40 additions and 0 deletions

View file

@ -310,6 +310,8 @@ private:
int alloc_fd(int first_candidate_fd = 0);
void disown_all_shared_buffers();
KResultOr<String> find_shebang_interpreter_for_executable(const String& executable_path);
Thread* m_main_thread { nullptr };
RefPtr<PageDirectory> m_page_directory;