FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

oxccc/minishell · GitHub

Repository navigation

Public

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

37 Commits

Folders and files

Repository files navigation

Minishell

This project has been created as part of the 42 curriculum by lutsiara.

Description

Minishell is a project that aims to create a simple, functional shell, similar to a mini version of Bash. It provides a platform to gain extensive knowledge about processes, file descriptors, and command-line parsing.

Key features include:

  • Interactive command-line interface with history.
  • Handling of absolute and relative paths.
  • Built-in commands: echo, cd, pwd, export, unset, env, and exit.
  • Pipelines (|) for chaining commands.
  • Redirections (<, >, <<, >>).
  • Environment variable expansion ($VAR, $?).
  • Logical operators (&&, ||).
  • Wildcard expansion (*).
  • Signal handling (Ctrl-C, Ctrl-D, Ctrl-\).

Architecture

Minishell is structured into several modular components to ensure clean separation of concerns and maintainability:

  • Lexer (lexer.c): Tokenizes the input string into a list of meaningful tokens (words, operators, etc.).
  • Expander (expander.c): Processes tokens to handle environment variable expansion and quote removal.
  • Parser (parser.c): Converts the sequence of tokens into a linked list of t_command structures, which hold the command arguments, file descriptors for input/output, and logical operators.
  • Executor (executor.c): The core engine that orchestrates command execution. It manages:
    • Built-in commands via direct execution.
    • External commands via path searching and execve.
    • Pipelines and redirections using fork, pipe, and dup2.
  • Environment Management (environment.c): Maintains a linked list representing the shell's environment variables.
  • Built-ins (src/builtins/): Individual modules for each mandatory shell built-in command.

Instructions

Compilation

To compile the project, use the provided Makefile:

make

To remove all compiled objects and binaries:

make fclean

To recompile:

make re

Execution

Once compiled, run the shell:

./minishell

Resources

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages


Back | FazBrowse Home | New Git URL