Mokariou && isall
As beautiful as a shell
This project involves creating a simple shell—your very own bash.
By undertaking this, you'll delve into processes and file descriptors, learning about key systems programming concepts while building a fully functional shell.
7.1
Shells have existed since the beginning of IT, evolving from tedious switch-aligned programming to a more user-friendly command-line interface.
With Minishell, you can travel back in time and tackle the challenges faced by developers before GUI-based systems like Windows.
- Programming Language: C, adhering to the Norm.
- Stability:
- Functions must not crash unexpectedly (e.g., segmentation fault).
- No memory leaks are tolerated; heap-allocated memory must be properly freed.
- Makefile:
- Compile with flags
-Wall -Wextra -Werror
usingcc
. - Include the rules:
$(NAME)
,all
,clean
,fclean
,re
, and optionallybonus
.
- Compile with flags
- Libft: If allowed, include its sources in a
libft
folder. Your Makefile must compile it correctly. - Testing: Create test programs to validate your work; these will assist during defense.
- Name:
minishell
- Files to Submit:
Makefile
,*.h
,*.c
- Prompt: Display a prompt while awaiting input.
- Command Execution:
- Find and execute commands using
PATH
, absolute, or relative paths.
- Find and execute commands using
- Built-ins: Implement the following:
echo
(with-n
option)cd
(relative/absolute paths only)pwd
(print working directory)export
(no options)unset
(no options)env
(no options/arguments)exit
(no options)
- Redirections:
<
Redirect input.>
Redirect output.<<
Read until a delimiter (doesn't affect history).>>
Append output.
- Pipes (
|
): Link commands together using a pipeline. - Environment Variables: Expand
$
variables and handle$?
for the last exit status. - Interactive Mode:
ctrl-C
: Display a new prompt.ctrl-D
: Exit shell.ctrl-\
: Ignore.
- Quotes:
- Single (
'
): Treat enclosed content literally. - Double (
"
): Interpret$
while keeping other characters literal.
- Single (
- Signal Handling: Use a single global variable to handle received signals.
readline
, add_history
, fork
, execve
, pipe
, dup
, signal
, getenv
, and more.
The following features can be implemented if the mandatory part is perfect:
- Logical operators:
&&
and||
with parenthesis for priorities. - Wildcards (
*
): Match files in the current directory.
- Repository: Submit to your assigned Git repository. Ensure all file names and structure are correct.
- Evaluation: Peer reviews will precede automated testing (Deepthought). A single failure will halt the automated evaluation.