CS208 Introduction to Computer Systems Friday, 7 November 2025 + Command shell steps (assume no > or |) - print prompt - read user's command - fork - child - build argv and argc - execvp - parent - wait for child to terminate - parent's wait is over - go to beginning + Sample programs - forktest.c - exectest.c - argv.c - exectest_with_args.c - tokenizer assignment (but NOTE THE NULL at the end of argv[]) + Command shell steps: "command > file" ... - child - build argv and argc - redirect stdout to file <--- - execvp ... + Sample programs - files.c - redirection.c + Command shell steps: "command1 | command2" PLAN - parent forks to create child1 (for command1) - parent forks again to create child2 (for command2) - child1 redirects its own stdout - child2 redirects its own stdin FLOW - print prompt - read user's command line [execute_command] - notice the | [call the "do pipe command" function] - create a pipe - fork - child - build argv and argc (stopping at |) - redirect stdout to write-end of the pipe - execvp - parent - fork - child - build argv and arc (starting just after |) - redirect stdin to read-end of the pipe - execvp - parent - wait for child to terminate - wait for child to terminate - parent's waits are over - go to beginning + Sample programs - pipe.c + One more sample program - shell208.c