How to use execv for commands whose location is not known? How to use execv for commands whose location is not known? unix unix

How to use execv for commands whose location is not known?


Use execvp(3) instead of execv(3). execvp and execlp work exactly like execv and execl respectively, except they search the $PATH environment variable for an executable (see the man page for full details).