A small Unix-like shell implemented in C that reproduces core bash features: parsing, execution, redirections, heredoc, pipes, and a selection of builtins.
- Display interactive prompt with history.
- Handle quoted strings (single & double quotes).
- Support input/output redirections and heredoc.
- Support pipes between commands.
- Expand environment variables.
- Provide builtin commands executed in the parent where required.
- Basic signal handling to avoid unwanted termination.
Build:
makeRun:
./minishellRun tests (simple script included):
./test_minishell.sh
# or the checker:
./github_checker_checker.sh- Entry point: main.c (
main) - Core loop: src/minishell.c (
minishell) — reads prompt, history, calls parser and executor. - Parser & helpers:
src/parse/*(see files undersrc/parse/aux/) — tokenization and argument handling.- Heredoc: src/parse/aux/heredoc.c (
heredoc) — creates temporary heredoc files and collects input. - File handling: src/parse/aux/handle_file.c
- Heredoc: src/parse/aux/heredoc.c (
- Execution:
src/execute/*— process management, redirection, builtins.- Interfaces: include/execute.h
- Verification & shutdown: src/verify/end.c (
end) - Data types & globals: include/structs.h
- Public API and macros: include/minishell.h
- Build: Makefile
- Prompt and history via GNU readline (linked by Makefile).
- Built-in commands implemented in
src/builtin/*(examples:ft_cd,ft_pwd,ft_export,ft_unset,ft_env,ft_echo,ft_exit). - Redirections:
<(ARROW_LEFT),<<(DOUBLE_ARROW_LEFT/heredoc),>(ARROW_RIGHT),>>(DOUBLE_ARROW_RIGHT).
- Heredoc: temporary file
.heredoc_<n>created byheredoc. - Process management: pipes and forks handled under
src/execute/(see include/execute.h). - Errors: reported using
endin src/verify/end.c.
- The project depends on a local libft (see
MakefileLIBFT_PATH). - Compiler flags:
-Werror -Wextra -Wall -g. - Object files are placed under
.build/as configured in theMakefile.
- Use
maketo compile with debug symbols (-g). - Use the included test scripts:
- For investigating heredoc behavior inspect
heredocandhandle_file.
- Follow coding style and tests already present.
- Add unit tests or integration tests under
minishell_tester/or via new scripts.
- Libft helper library required: clone or build as defined in
Makefile(LIBFT_URL). - See
Makefilefor build and test targets.