main: register SIGCHLD handler while user hasn't entered "exit" loop print prompt get command to run from user input trim whitespace from command if command is exit, quit else if command is sleep, then call mysleep fct else if command is showstatus, then print status of last command else call run_command fct end while run_command: block SIGCHLD call parse_command fct call fork parent: if not bkg command, parent calls sigsuspend with empty mask, else return child: if there are no pipes call run_child fct else call pipe call fork parent: (will run the right hand side of the pipe) calling close and dup2 connect stdin to pipe call run_child fct child: (will run the left hand side of the pipe) calling close and dup2 connect stdout to pipe call run_child fct run_child: if input redirection is needed open input file for read, call dup2, call close if output redirection is needed open output file for write, call dup2, call close Note: input redir on rhs of pipe is error, so is output redi on lhs of pipe call some version of exec (most likely execvp?) parse_command: break command string into array by whitespace check for background command by last token being & check for pipe in the command, if so, break into 2 arrays at the pipe (left command, right command) check for input and output redirection (on both commands if pipe) mysleep: use class notes to develop sig_chld_handler: store exit status of command