An interactive shell in C
Man Yuet Ki Kimmy
e.g.
ls -la
/home/word/a.out
./a.out
If a program is executed in this shell, the reaction after Ctrl-C
depends on the feature set in this executed program.
cat a.txt | grep t | wc -l
This shell program ignore Ctrl-C
. You can only terminate with
exit
It release all its resources and then terminate.
Use timeX
before the command to show the terminated process's ID, program name (without the path), user cpu time and system cpu time.
e.g.
Input
timeX cat a.txt | grep t | wc -l
Output
10
(PID)89 (CMD)cat (user)0.001 s (sys)0.000 s
(PID)90 (CMD)grep (user)0.001 s (sys)0.000 s
(PID)91 (CMD)wc (user)0.001 s (sys)0.000 s
Add &
behind the command needed to be executed in the background.
vi &
If invalid input is inputted, error message is given.
gcc 3230shell.c -o 3230shell
./3230shell
Copyright 2022 Man Yuet Ki Kimmy