exec.c 267 B

12345678910111213
  1. #include <unistd.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. int main(void) {
  5. char* args[] = {"sh", "-c", "echo 'exec works :D'", NULL};
  6. int status = execv("/bin/sh", args);
  7. if (status == -1) {
  8. perror("execv");
  9. exit(EXIT_FAILURE);
  10. }
  11. }