Minishell is a simple shell that mimics the functionalities of Bash. This project aims to provide a basic understanding of how shells work, including process creation and management, file descriptors, and command execution in Unix-like operating systems.
- Prompt Display: Shows a prompt while waiting for a new command.
- Command History: Maintains a history of executed commands.
- Executable Search and Execution: Locates and executes the correct executable based on the
PATH
variable or using a relative/absolute path. - Built-in Commands:
echo
with-n
optioncd
with relative or absolute pathspwd
with no optionsexport
with no optionsunset
with no optionsenv
with no options or argumentsexit
with no options
- Redirections:
<
for input redirection.>
for output redirection.<<
for here-document functionality.>>
for output redirection in append mode.
- Piping: Supports piping (
|
) to pass output from one command as input to another. - Environment Variables: Expands environment variables (
$VAR
) and special parameter ($?
). - Special Character Handling:
- Single quotes (
'
) to prevent meta-character interpretation. - Double quotes (
"
) to prevent meta-character interpretation except for$
. - Control characters (
ctrl-C
,ctrl-D
,ctrl-\
) with behavior similar to Bash.
- Single quotes (
To compile Minishell, use the provided Makefile. The Makefile includes the following rules:
all
: Compile the source files.clean
: Remove object files.fclean
: Remove all generated files.re
: Recompile the project.bonus
: Compile bonus features (if applicable).