Step 2 - Challenge: Handling Multiple Commands
In this step your goal is to handle multiple commands. To do that you’ll want to wrap your existing command handling code in a loop. We want that loop to continue indefinitely, but we will also want to be able to exit from the shell.
To allow us to exit the shell most commands offer a builtin command - I bet you can’t guess what the command is! 😀
So to complete this step, extend your shell to accept multiple commands until the user enters the builtin command: exit
.
That should look something like this:
% ccsh
ccsh> ls
LICENSE README.md go.mod main.go
ccsh> pwd
/Users/johncrickett/dev/goccsh
ccsh> exit
%
Don’t forget to make your shell wait for the running command to finish before trying to capture the next command from a user.
Give it a go now, and move on to the next lesson when you're stuck/ready to see how I approached it.