Minishell
First step in the creation of a shell. This project consists in a mini-shell capable of reading and evaluating simple user commands. Trivial lexical analysis and parsing of the command. Searching for the corresponding binary on the machine and execute it, or execute the relevant code in the case of a “built-in” command in the shell.
1. Project Partners
2. Install
make
2.1. Make Options
make
: Compiles the files and creates the executableminishell
make clean
: Remove binary files.make fclean
: Deletes the binary files and theminishell
executable file.make re
: Deletes the binary files and theminishell
executable file and recompiles them.
3. Features
3.1 Builtins
3.2 Prompt
The prompt is displayed as follows:
["shell name"] :: "current directory" ->
The current directory is updated live, each time you change directory, of course, the information is collected from the environment variable PWD
.
3.3 Execution of Commands
The command shall be searched for using the PATH environment variable.
It is possible to specify the paths where the command to execute resides (in case you want to execute a command that does not reside in any directory of the PATH variable, or the variable is not defined).
The parameters of each command are taken into account.
3.7 Management Of Internal Variables
- List the internal variables of the shell via the built-in env.
- Removal of internal and environmental variables, via the built-in unsetenv.
- Creation of environment variables for a single command via the built-in setenv.
3.9 Parameter Expansions
~
HOME path of the current user. Is replaced by the HOME path of the current user.