The goal of this project is to create a simple shell. Will be your own little bash or zsh. You are going to learn a lot about processes and file descriptors.
Minishell runs executables from an absolute, relative or environment PATH (/bin/ls or ls), including arguments or options. ', \ and " work the same as bash, except for multiline commands.
You can separate commands with ;, as well as use redirections > >> < and pipes |.
Environment variables are handled, like $HOME, including the return code $?.
Finally, you can use Ctrl-C to interrupt and Ctrl-\ to quit a program, as well as Ctrl-D to throw an EOF, same as in bash.
A few of the functions are "built-in", meaning we don't call the executable, we re-coded them directly. It's the case for echo, pwd, cd, env, export, unset and exit.
- malloc
- free
- write
- open
- read
- close
- fork = Creates a child process.
- wait, waitpid = Stops the parent process until the child process exit.
- wait3, wait4 = Are similar to waitpid, but additionally return resource usage information about the child.
- signal = Sets a function to handle a signal.
- kill = Sends a signal to a process or a group of processes.
- exit = Terminates a process immediately, special handle for child processes.
- getcwd = Saves the pathname of your current working directory in a string.
- chdir = Changes your current working directory.
- stat, lstat, fstat = Returns information about a file.
- execve = Executes a program referred by a variable.
- dup = Creates a copy of a file descriptor using the lowest numbereded unused descriptor.
- dup2 = Creates a copy of a file descriptor using the descriptor number given by the user.
- pipe = It's used to create inter-process communication.
- opendir = Opens a directory stream.
- readdir = Returns a pointer to a dirent structure representing the next directory entry in the directory stream.
- closedir = Closes the directory stream.
- strerror = Returns an error message.
- errno = Number of last error, its a variable.
Deployment
git clone https://github.com/mbani01/minishell.git
make && ./minishellThis two-person project was done with mamoussa.
I was responsible for the lexing, parsing, argument checking, and environment variables.
Mamoussa took care of the execution, built-in functions, signal handling ,redirection and piping .
