Step 8 - Challenge: Command History
Step 8 - Challenge: Command History
Build Your Own Shell (Python Edition)
Step 1 - Create The Simplest Possible Command Line Shell
Step 1 - Create The Simplest Possible Command Line Shell
Step 2 - Challenge: Handle Multiple Commands
Step 2 - Challenge: Handle Multiple Commands
Step 3 - Non Existent Commands
Step 3 - Non Existent Commands
Step 4 - External Commands With Arguments
Step 4 - External Commands With Arguments
Step 7 - Handling Signals
Step 7 - Handling Signals
Conclusion
Conclusion
n this step your goal is to add a command history to your shell. You want to have the following features:
Save all executed commands to the history.
Save the history to disk when the shell exits (to a file, .ccsh_history in the users HOME directory.
Reload the history from disk when the shell is started.
Support the built in command: history to list the command history.
That might look something like this:
ccsh> ls
Cargo.lock Cargo.toml src target test.txt
ccsh> pwd
/Users/johncrickett/dev/CodingChallengesFYI/challenge-shell/ccsh
ccsh> ls
Cargo.lock Cargo.toml src target test.txt
ccsh> history
ls
pwd
ls
ccsh> exit
ccsh %
Once you’ve got all that working - congratulations, you’ve built your own command line shell!