How jdecorte-be/minishell works
Minishell is a POSIX-oriented interactive shell: it reads commands, prepares and parses input, then executes builtins or system programs while tracking shell state. The README documents pipes, redirections, here-documents, variable and exit-status expansion, history, and signal handling. The main loop and several execution and expansion components are evidenced in source excerpts; other capability links below rely on the README, so unsampled implementation details are not inferred.
Main entry points: main.c Interactive loop · ft_chdollar.c Variable expansion · ope_2.c Execution dispatch · exec.c Command execution
Components 17
Shell interaction
- Interactive loop
src/main.c - Signal handling
src/signal/signal.c
Command processing
- Input preparation
src/main.c - Command parser
src/lst/token_2.c - Token structures
src/lst/token.c - Variable expansion
src/utils/ft_chdollar.c - Redirections
src/utils/file_redirect.c - Here-documents
src/utils/here_doc.c
Execution runtime
- Execution dispatch
src/exec/ope_2.c - Command execution
src/exec/exec.c - Pipelines
src/exec/pipe.c - Builtins
src/builtins/export.c - System programs
src/exec/exec.c
Shell state and support
- Environment
src/builtins/env.c - Shell status
includes/minishell.h - C utility library
libft/libft.h
Other components
- Shell user
Connections 18
- Shell user → Interactive loop: enters commands
src/main.c - Interactive loop → Input preparation: prepares input
src/main.c - Interactive loop → Command parser: parses input
src/main.c - Interactive loop → Execution dispatch: executes tokens
src/main.c - Command parser → Token structures: creates tokens
- Interactive loop → Variable expansion: expands variables
- Interactive loop → Redirections: handles redirects
- Interactive loop → Here-documents: handles heredocs
- Execution dispatch → Command execution: dispatches commands
src/exec/ope_2.c - Command execution → Builtins: selects builtins
src/exec/exec.c - Command execution → System programs: forks and executes
src/exec/exec.c - Execution dispatch → Pipelines: supports pipelines
- Builtins → Environment: reads and updates
src/builtins/env.c - Variable expansion → Environment: looks up variables
src/utils/ft_chdollar.c - Variable expansion → Shell status: expands exit status
src/utils/ft_chdollar.c - Interactive loop → Signal handling: registers handlers
src/main.c - Interactive loop → Shell status: tracks last result
src/main.c - Interactive loop → C utility library: uses utilities
src/main.c