commit 62ece126f94b1dd3dc54b73fef653b08d8cfa8a3 Author: Guillem George Date: Thu Oct 23 17:36:07 2025 +0200 ' diff --git a/microshell/a.out b/microshell/a.out new file mode 100755 index 0000000..a27d743 Binary files /dev/null and b/microshell/a.out differ diff --git a/microshell/microshell.c b/microshell/microshell.c new file mode 100644 index 0000000..72dbf99 --- /dev/null +++ b/microshell/microshell.c @@ -0,0 +1,26 @@ +#include +#include +#include +#include + +int main(int argc, char **argv) +{ + if (argc < 2) + errx(1, "Not enough args"); + + int id = fork(); + if (id < 0) + errx(1, "Cannot fork"); + + if (id == 0) + { + int res = 0; + wait(&res); + return res; + } + else + { + int res = execl("/bin/sh", "supershell", "-c", argv[1], NULL); + exit(res); + } +}