/** * execlp.c * * Demonstration of execlp(3). While execvp(3) supports executing an array of * command line arguments, execlp takes a list of arguments directly while still * searching the path (unlike the execl(3) call we saw in our first fork.c * example). * * Compile: gcc -g -Wall execlp.c -o execlp * Run: ./execlp */ #include #include #include #include #include int main(int argc, char *argv[]) { /* Runs 'ls -l -a': */ execlp("ls", "ls", "-l", "-a", NULL); return 0; }