commit 122205c0d140d6f49cc9dad61d35c41a18693812 Author: benstrb Date: Sat Oct 4 12:38:50 2025 +0200 first diff --git a/shell b/shell new file mode 100755 index 0000000..c41a5d2 Binary files /dev/null and b/shell differ diff --git a/shell.c b/shell.c new file mode 100644 index 0000000..fdd409f --- /dev/null +++ b/shell.c @@ -0,0 +1,24 @@ +#include +#include + +int main() { + char command[255]; + + while (1) { + write(1, "benag@shell > ", 14); + int count = read(0, command, 255); + // /bin/ls\n -> /bin/ls\0 + command[count - 1] = 0; + + char *args[] = {command, NULL}; + pid_t fork_result = fork(); + + if (fork_result == 0) { + execve(command, args, 0); + break; + } else { + siginfo_t info; + waitid(P_ALL, 0, &info, WEXITED); + } + } +}