This project objective is to sort data on a stack, with a limited set of instructions, using the lowest possible number of actions. To succeed the student has to manipulate various types of algorithms and choose the most appropriate solution (out of many) for an optimized data sorting.
Table of Contents
The Minishell project object is to write a shell that replicates several features and behavior of the Bourne Again Shell (BASH).
The features we are required to implement are:
- Display a prompt when waiting for a new command.
- Have a working history.
- Search and launch the right executable (based on the PATH variable or using a relative or an absolute path).
- Not use more than one global variable.
- Not interpret unclosed quotes or special characters which are not required by the subject such as \ (backslash) or ; (semicolon).
- Handle ’ (single quote) which should prevent the shell from interpreting the metacharacters in the quoted sequence.
- Handle " (double quote) which should prevent the shell from interpreting the metacharacters in the quoted sequence except for $ (dollar sign).
- Implement redirections:
<should redirect input.>should redirect output.<<should be given a delimiter, then read the input until a line containing the delimiter is seen. However, it doesn’t have to update the history!>>should redirect output in append mode.
- Implement pipes (| character). The output of each command in the pipeline is connected to the input of the next command via a pipe.
- Handle environment variables ($ followed by a sequence of characters) which should expand to their values.
- Handle $? which should expand to the exit status of the most recently executed foreground pipeline.
- Handle ctrl-C, ctrl-D and ctrl-\ which should behave like in bash.
- In interactive mode:
ctrl-Cdisplays a new prompt on a new line.ctrl-Dexits the shell.ctrl-\does nothing.
- Implement the following builtins:
echowith option -n.cdwith only a relative or absolute path.pwdwith no options.exportwith no options.unsetwith no options.envwith no options or arguments.exitwith no options.
Clone the repo and make it to compile. Run the binary located at the /bin folder with random number as parameters. The program will print several instructions on the terminal representing each action that eventually will sort the stack of numbers you prodived as parameters. You will probably need a visualizer program to actually validate the final stack order. There are several visualizers on github and even online ones.
Here's a few:
Distributed under the GNU General Public License version 3 (GPLv3).
Christian C. Del Moro - christian.delmor@gmail.com
Project Link: https://github.com/chrisdelmoro/minishell
