开发者

execve in unix systems

开发者 https://www.devze.com 2023-01-24 22:02 出处:网络
#include<unistd.h> int main(int argc, char **argv) { 开发者_高级运维int ret; ret = execve(\"/bin/bash\", NULL, NULL);
#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.

0

精彩评论

暂无评论...
验证码 换一张
取 消