Skip to content

abouabra/42-Minishell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

92 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minishell

Description

Minishell is a simple shell implementation in C. It is a project from the 42 school curriculum. The goal of this project is to create a simple shell that can handle basic commands, environment variables, and signal handling, it also has to be able to handle redirections and pipes. it also has a group of built-in commands that are implemented in C.

Installation

  1. Clone the repository:
git clone https://github.com/abouabra/42-Minishell.git
  1. Change the current working directory:
cd 42-Minishell
  1. Compile the project:
make
  1. Run the program:
./minishell

Features

Minishell provides the following features:

  • Command execution: Minishell can execute commands entered by the user, including built-in commands and external programs.
  • Quoting: Minishell supports single and double quotes to group arguments together.
  • Built-in commands: Minishell supports built-in commands such as cd, echo, pwd, export, unset, env, and exit.
  • Environment variables: Minishell can manage environment variables it including displaying using the $ symbol, exporting, and unsetting variables.
  • Input/output redirection: Minishell supports input/output redirection using <, >, and >> symbols.
  • Pipes: Minishell supports piping multiple commands together using the | symbol.
  • Signal handling: Minishell handles signals such as Ctrl+C (SIGINT) and Ctrl+\ (SIGQUIT) gracefully.
  • Error handling: Minishell provides informative error messages when commands fail to execute.
  • Command history: Minishell supports command history using the up and down arrow keys.
  • support for wildcard expansion using the * symbol.
  • && and || operators for conditional execution of commands.

Usage

Once you have compiled the minishell program and run it, you can start using it as follows:

  1. Enter commands at the prompt and press Enter to execute them. For example:
$ ls -l
  1. Use built-in commands such as cd, echo, exit, and env as needed. For example:
$ cd <directory>
  1. Use input/output redirection and pipes to perform more complex operations. For example:
$ ls -l > output.txt
$ cat input.txt | grep "pattern"
  1. use the * wildcard to match any character in a file name. For example:
$ ls *.c
  1. use the && and || operators for conditional execution of commands. For example:
$ ls -l && echo "ls succeeded" || echo "ls failed"
  1. To exit Minishell, use the exit command:
$ exit

Final Note

If you have any suggestions or improvements, feel free to open an issue or submit a pull request.

About

Minishell is a simple shell implementation in C

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published