Giter VIP home page Giter VIP logo

minishell's Introduction

minishell

Our goal ๐ŸŽฏ


  • The final challenge in the C language
  • The students learned the importance of team projects
  • understanding of shell programming and how the operating system works

Commit Rules ๐Ÿ“œ


  • Force push and push to main branch are prohibited
  • Create and push a sub-branch instead of the main branch
  • Sub-branch should have a title and a comment
  • Each commit have to be pushed with a brief comment of what you've written code
  • Use labeling and questions for peer review

Process ๐Ÿงถ


  1. Input Handling
  • Use the readline or read system call to accept user input.
  • Analyze the input string to separate commands from arguments.
  1. Command Parsing
  • Tokenizes the input string and breaks it into individual commands and arguments.
  • Handles pipes (|), redirects (<, >, >>), and other special characters.
  • Handles quoting (", ') to preserve whitespace and special characters.
  1. Environment Variable Handling
  • Implement the env command to print the current environment variables.
  • Implement the export command to set a new environment variable or modify an existing one.
  • Implement the unset command to remove an environment variable.
  • Handle the $ character to expand the value of an environment variable.
  1. Implement Built-in Commands
  • Implement the cd command to change the current working directory.
  • Implement the echo command to print the arguments.
  • Implements the pwd command to print the path to the current working directory.
  • Implements the exit command to exit the shell.
  1. External Command Execution
  • Use the fork system call to create a newkprocess.
  • In the child process, use the execve system call to execute an external command.
  • The parent process waits for the child process and handles its exit status.
  1. Signal Handling
  • Handles the SIGINT signal (Ctrl+C) to interrupt the current instruction.
  • Handles the SIGQUIT signal (Ctrl+\) to generate a core dump.
  1. Pipeline Handling
  • Organize instruction sequences into pipelines for processing.
  • Creates multiple processes and connects them with a pipe to pass the output to the input of the next process.
  1. Redirection Handling
  • Use the < operator to read input from a file.
  • Write output to a file using the > operator (overwrite mode).
  • Append output to the file using the >> operator (append mode).
  1. Path Search
  • Use the PATH environment variable to search for the path to an external command.
  • The current directory is included in the search path.
  1. Implement Additional Features
  • Add extended features (e.g., history, autocomplete, aliases, etc.).
  • Implement error handling and debugging features.

Flow Diagram ๐Ÿ”

minishell_diagram

Version

  • norminette 3.3.51

minishell's People

Contributors

action2thefuture avatar rabouzia avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.