Skip to content

A lightweight, customizable command-line shell with support for pipelines, redirections, and custom built-ins. πŸ–₯️✨ Perfect for diving deep into shell programming! πŸš€πŸ”§

License

Notifications You must be signed in to change notification settings

abel-hid/minishell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ–₯️ Minishell

Overview

Minishell is a lightweight Unix shell implementation that provides a basic command-line interface for executing commands and managing processes. This project is designed to help you understand shell concepts, process management, and command execution in Unix-like systems. 🌟

πŸš€ Project Objectives

  • Implement a basic Unix shell that can interpret and execute commands.
  • Support built-in commands and external commands with arguments.
  • Manage processes, handle input/output redirection, and implement piping between commands.

πŸ› οΈ Key Features

Command Execution

  • Execute External Commands: Run programs and scripts from the command line.
  • Support for Arguments: Pass arguments to commands and handle them appropriately.

Built-in Commands

  • cd: Change the current working directory.
  • pwd: Print the current working directory.
  • echo: Display a line of text.
  • exit: Exit the shell with a specified exit status.

Input/Output Redirection

  • Redirect Input: Use < to redirect input from a file.
  • Redirect Output: Use > to redirect output to a file.
  • Append Output: Use >> to append output to a file.

Piping

  • Pipe Commands: Use | to pass the output of one command as input to another.

πŸ“‹ Project Structure

.
β”œβ”€β”€ LICENSE
β”œβ”€β”€ Makefile
β”œβ”€β”€ README.md
β”œβ”€β”€ en.subject.pdf
└── srcs
    β”œβ”€β”€ cd.c
    β”œβ”€β”€ cd2.c
    β”œβ”€β”€ check_builtins.c
    β”œβ”€β”€ cmd.c
    β”œβ”€β”€ create_lexer.c
    β”œβ”€β”€ dollar.c
    β”œβ”€β”€ echo.c
    β”œβ”€β”€ env.c
    β”œβ”€β”€ exec_builtins.c
    β”œβ”€β”€ exec_utils.c
    β”œβ”€β”€ exec_utils2.c
    β”œβ”€β”€ execute.c
    β”œβ”€β”€ execute_bin.c
    β”œβ”€β”€ execute_bin2.c
    β”œβ”€β”€ execution_utils.c
    β”œβ”€β”€ exit.c
    β”œβ”€β”€ expand_value.c
    β”œβ”€β”€ expander.c
    β”œβ”€β”€ expander_utils.c
    β”œβ”€β”€ export.c
    β”œβ”€β”€ export2.c
    β”œβ”€β”€ export_tools.c
    β”œβ”€β”€ free.c
    β”œβ”€β”€ ft_env.c
    β”œβ”€β”€ ft_error.c
    β”œβ”€β”€ heredoc.c
    β”œβ”€β”€ lexing.c
    β”œβ”€β”€ lexing_utils.c
    β”œβ”€β”€ libft.c
    β”œβ”€β”€ libft2.c
    β”œβ”€β”€ list.c
    β”œβ”€β”€ main.c
    β”œβ”€β”€ main_helper.c
    β”œβ”€β”€ minishell.h
    β”œβ”€β”€ parse_args.c
    β”œβ”€β”€ parsing.c
    β”œβ”€β”€ parsing_error.c
    β”œβ”€β”€ parsing_redirction.c
    β”œβ”€β”€ parsing_utils.c
    β”œβ”€β”€ parsing_utils2.c
    β”œβ”€β”€ pipe_execution.c
    β”œβ”€β”€ pwd.c
    β”œβ”€β”€ quote.c
    β”œβ”€β”€ syntax.c
    β”œβ”€β”€ syntax_utils.c
    β”œβ”€β”€ t.c
    β”œβ”€β”€ t2.c
    β”œβ”€β”€ test.c
    β”œβ”€β”€ unset.c
    └── update_oradd_env.c

2 directories, 54 files

πŸ”§ Compilation

To compile the project, use the provided Makefile:

make

This will generate an executable called minishell.

πŸ“ˆ Usage

To run the shell, execute the minishell binary:

./minishell

You will enter the shell prompt where you can type commands and interact with the shell.

Example Commands

  • List Files: ls -l
  • Change Directory: cd /path/to/directory
  • Print Working Directory: pwd
  • Redirect Output to a File: echo "Hello World" > output.txt
  • Pipe Commands: cat file.txt | grep "keyword"

πŸ§ͺ Testing

Test your shell by:

  • Executing a variety of commands and built-in commands.
  • Using input/output redirection to handle files.
  • Testing piping between multiple commands.
  • Checking edge cases like invalid commands or syntax errors.

πŸ“š Learning Objectives

By completing this project, you will:

  • Gain a solid understanding of how Unix shells work.
  • Learn about process creation, management, and synchronization.
  • Understand command parsing, redirection, and piping in a shell environment.

🌟 Bonus Objectives

For additional practice and enhancement, consider the following:

  • Job Control: Implement job control features like background processes and signal handling.
  • Command History: Add support for command history and navigation.
  • Tab Completion: Implement tab completion for commands and file paths.

πŸ“œ License

This project is open-source and available under the MIT License. Feel free to fork, modify, and contribute!

About

A lightweight, customizable command-line shell with support for pipelines, redirections, and custom built-ins. πŸ–₯️✨ Perfect for diving deep into shell programming! πŸš€πŸ”§

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published