Skip to content

Instantly share code, notes, and snippets.

@ephemient
Created November 14, 2020 09:15
Show Gist options
  • Save ephemient/61e6c25bd938ad3fd1f44d8fe597bcb4 to your computer and use it in GitHub Desktop.
Save ephemient/61e6c25bd938ad3fd1f44d8fe597bcb4 to your computer and use it in GitHub Desktop.
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
int main() {
int pipefd[2];
close(0);
close(1);
pipe(pipefd);
write(1, "echo $Q\n", 8);
execle("/bin/sh", "sh", NULL, (char *[]) {"Q=echo $Q", NULL});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment