我在一个迷你项目中工作:"我自己的命令解释器(壳)",像Bash shell或Sh shell.直到现在它可以执行每个预定义的命令,如ls,ps,pwd,date.除此之外,我已经实现了一些其他操作,如输入重定向(<),输出重定向(>),PIPE(|)功能.除此之外,我已经实现了自己的用户命令,如pid,ppid,quit,hist.
vvdnlt208@vvdnlt208-Vostro-3446:~/project/Vector/sourabh/unix/proj2$ ./my_sh
<1 SOURABH> ls
a cd.c execute.o inredir.c main.o multiexec.o my_sh sh.c sigign.c test.c
addhist.c dir header.h inredir.o Makefile mypipe.c outredir.c showhist.c sigign.o tetest.c
addhist.o execute.c inredir main.c multiexec.c mypipe.o outredir.o showhist.o test2.c
<2 SOURABH> ps
PID TTY TIME CMD
6120 pts/10 00:00:01 bash
6510 pts/10 00:00:00 grep
6512 pts/10 00:00:00 grep
6514 pts/10 00:00:00 grep
6516 pts/10 00:00:00 grep
7772 pts/10 00:00:00 my_sh
7774 pts/10 00:00:00 ps
<3 SOURABH> pwd
/home/vvdnlt208/project/Vector/sourabh/unix/proj2
<4 SOURABH> date
Fri …Run Code Online (Sandbox Code Playgroud)