1 #include <stdio.h>
2 #include <unistd.h>
3 #include <sys/types.h>
4 #include <sys/wait.h>
5 int main(void){
6 // execl("/bin/ps","ps","-o","pid,ppid,comm",NULL);
7 execl("/bin/ls","ls","-l",NULL);
8 return 3;
9 }
tarena@ubuntu:~/uc/day08$ a.out
总用量 48
-rwxrwxr-x 1 tarena tarena 8381 4月 21 22:32 a.out
-rw-rw-r-- 1 tarena tarena 684 4月 20 15:14 child.c
-rw-rw-r-- 1 tarena tarena 579 4月 21 16:15 day08.txt
-rw-rw-r-- 1 tarena tarena 208 4月 21 23:08 exec.c
-rw-rw-r-- 1 tarena tarena 412 4月 21 12:42 execle.c
-rw-rw-r-- 1 tarena tarena 13 4月 21 22:27 hello.c
-rw-rw-r-- 1 tarena tarena 247 4月 21 22:32 system2.c
-rw-rw-r-- 1 tarena tarena 262 4月 21 22:29 system.c
-rw-rw-r-- 1 tarena tarena 571 4月 20 13:22 wait.c
-rw-rw-r-- 1 tarena tarena 587 4月 20 14:42 waitpid.c
tarena@ubuntu:~/uc/day08$ echo $?
0
1 #include <stdio.h>
2 #include <unistd.h>
3 #include <sys/types.h>
4 #include <sys/wait.h>
5 int main(void){
6 // execl("/bin/ps","ps","-o","pid,ppid,comm",NULL);
7 // execl("/bin/ls","ls","-l",NULL);
8 return 3;
9 }
tarena@ubuntu:~/uc/day08$ a.out
tarena@ubuntu:~/uc/day08$ echo $?
3
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。