I am writing a basic shell in Linux as a hobby, I want to start working on program execution, but have no idea on how to do this. I have seen execp()
and its various brothers and sisters, but apparently that forces the kernel to drop the currently running process, in this case my shell, and continue with the new process.
So basically all I need is a function that I can use to call a command such as ls
or cd
have it execute and then return to my shell.
All help is appreciated.
Create a new process with fork
and then call exec
.