execve in unix systems
#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.....
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.
this code opens new shell..... like when you execute any command the shell copies itself and executes the command.
精彩评论