Reputation: 43
#include<unistd.h>
int main(int argc, char **argv)
{
int ret;
ret = execve("/bin/bash", NULL, NULL);
return 0;
}
i m confuse about why the null values are passsed in execve please help.....
Upvotes: 1
Views: 364
Reputation: 420
this code opens new shell..... like when you execute any command the shell copies itself and executes the command.
Upvotes: 1
Reputation: 169018
Those parameters correspond to the program's arguments and environment. By passing NULL in for both, the caller is indicating that no arguments should be supplied to the program and no environment variables should be supplied either.
Upvotes: 6