I\'m having some problems with execve. I\'m trying to make a shell that can function just like the bash shell, but I have problems with the forked child executing a command.
If you don't want to manually travel through the fileystem to find the correct binary, there is execlp
(with an additional p).
From the manpage:
The execlp(), execvp(), and execvpe() functions duplicate the actions of the shell in searching for an executable file if the specified filename does not contain a slash (/) character. The file is sought in the colon-separated list of directory pathnames specified in the PATH environment variable. If this variable isn't defined, the path list defaults to the current directory followed by the list of directories returned by confstr(_CS_PATH). (This confstr(3) call typically returns the value "/bin:/usr/bin".) [...]