I want to use the execl
function to invoke both commands cd and vi from my c program, but it does not work.
This is what I did for rm and ls:
execl("/bin/ls", "ls", NULL);
execl("/bin/rm", "rm", args[1], NULL); //args is the array containing the arguments of the command
It works for ls
and rm
, but when I try to do the same thing with vi
and cd
it does not work.