0

Can someone please explain the use of exec functions when the input is given in command line? For example, if entered:

$ ./a.out ls -l

where a.out is the executable file. It would be great if you could share examples so that I can get clarification.

P.S. I've already gone through this thread, but I need clarification with command line inputs primarily.

Community
  • 1
  • 1
Doherty
  • 85
  • 1
  • 8
  • Have you read about [the `exec` family of functions](http://man7.org/linux/man-pages/man3/exec.3.html)? Do you know how to use the? Consider how you pass the arguments to e.g. `execvp`, and compare it to how your `main` function receives its arguments. Notice any similarities with the `execvp` arguments and the `main` function `argv` argument? – Some programmer dude Jan 03 '17 at 16:26
  • Oh by the way, you *are* aware of that allowing something like this could be a security hole big enough for an oil-tanker? – Some programmer dude Jan 03 '17 at 16:26
  • I have already been trying. However, I am not yet comfortable enough to answer anything related to exec functions, and thus, looking for help. I am not aware if it leaves a big hole, although that doesn't stops me from exploring it. It does make me more curios though. I can somehow use it (not the entire family) when I know the inputs. It might be helpful if you could share some examples or maybe a link as reference @Someprogrammerdude – Doherty Jan 03 '17 at 16:35

0 Answers0