Why does the command
execl("/bin/ls", NULL);
return a usage error, whereas the command
execl("/bin/ls", "badfsafds", NULL);
return a list of files in the directory in a simple C program?
I know that the first parameter of execl is path specification, but I thought it was only for path specification, not command execution. Thank you.
Here's a good example of correct usage:
You'll notice that if you print
argv[0]of any standard C program, it will show you the command that's being executed.