/42_School_minishell

This project is about creating a simple shell. Yes, your own little bash. You will learn a lot about processes and file descriptors. A deep dive into the inner workings of a shell by creating bash.

Primary LanguageC

Minishell

Overview

Welcome to Minishell, a project from the 42 Network that aims to create a lightweight shell with essential functionality, fully written in C.

Features

  • Prompt display: A clean and responsive prompt appears when waiting for a new command.
  • History: The shell maintains a functional command history.
  • Executable Launch: The shell searches and launches the correct executable based on the PATH variable or specified relative/absolute paths.
  • Signal handling: Uses a single global variable to indicate a received signal, ensuring that signal handlers don't access critical data structures.

Usage guidelines

To ensure a smooth experience, please keep the following guidelines in mind:

  • Quotation marks and special characters: The shell does not interpret unclosed quotation marks or unnecessary special characters such as \ (backslash) or ; (semicolon).
  • Quotation marks: Use ' (single quote) to prevent interpretation of metacharacters and " (double quote) to allow interpretation of metacharacters except $ (dollar sign).
  • Redirections: Implements various redirections, including input (<), output (>), append mode output (>>), and a heredoc-like feature (<<).
  • Pipes: Supports pipes (|) to connect the output of one command to the input of the next.
  • Environment Variables: Recognises and expands environment variables ($ followed by a string).
  • Builtins: Implements essential builtins, including echo, cd, pwd, export, unset, env and exit.

Signal handling

  • ctrl-C:** Displays a new prompt on a new line in interactive mode.
  • ctrl-D:** Exit the shell in interactive mode.
  • ctrl-:** Has no special effect in interactive mode.

Memory Management

The readline() function can cause memory leaks, which are reported but not fixed. However, all heap allocated memory must be properly freed to avoid leaks.

Feel free to explor and enjoy this school project