I called "ls" command using the execvp system call from inside a c file. But there seems to be a slight difference.
The exe files in the default ls call are highlighted green But not in my own execvp ls call. Am I missing something?
This is the piece of code that is calling ls.
else if (rc == 0)
{
// child (new process)
printf("hello, I am child (pid:%d)\n", (int) getpid());
char *myargs[2];
myargs[0] = strdup("ls");
// program: "wc" (word count)
myargs[1] = NULL;//strdup("p3.c"); // argument: file to count
//myargs[2] = NULL;
// marks end of array
execvp(myargs[0], myargs); // runs word count
printf("this shouldn’t print out");
}
