Skip to content

Chr-ss/minishell

Repository files navigation

minishell

This project is about creating a Bourne-Again Shell (BASH) replica for the minishell project at Codam. Minishell is therefore a user-mode program that implements a Command Line Interface (CLI).

In general terms what this program does is:

  • Print a prompt
  • Read a line
  • Parse
  • Execute
  • Repeat

Features

options

minishell:~$ pgrm -r -f path/to/file

i/o redirections

minishell:~$ pgrm < infile > outfile
minishell:~$ pgrm < infile >> outfile

pipes

minishell:~$ pgrm | pgrm2 | pgrm3

enviroment variables

minishell:~$ARG=something
minishell:~$ pgrm $ARG

previous foreground exit status

minishell:~$ pgrm $?

single quotes

minishell:~$ pgrm '$ARG $ARG2'

double quotes

minishell:~$ pgrm "$ARG $ARG2"

key bindings

  • arrow up / down for history.
  • ctrl-C displays a new prompt on a new line.
  • ctrl-D exits the shell.
  • ctrl-\ does nothing.

Built-ins

  • echo with option -n
  • cd with only a relative or absolute path
  • pwd with no options
  • export with no options
  • unset with no options
  • env with no options or arguments
  • exit with no options

Missing

  • scripting control
  • command / filename completion
  • background control
  • initialization / startup files

system calls

  • fork
  • exec
  • exit
  • wait
  • open
  • close
  • read
  • write
  • pipe
  • dup
  • chdir

GETTING STARTED

  1. Clone the repo
git clone https://github.com/Chr-ss/minishell.git
  1. cd into directory
cd minishell
  1. Call the Makefile
make

SOURCES / ACKNOWLEDGEMENTS

Documentation in README https://github.com/DimitriDaSilva/42_minishell?tab=readme-ov-file#1-extracting-information

Shell

https://www.cipht.net/2017/10/17/build-your-own-shell.html https://github.com/tokenrove/build-your-own-shell

https://brennan.io/2015/01/16/write-a-shell-in-c/ https://github.com/brenns10/lsh Shell in C Bash Architecture Bash Manual

Parsing

Parsing without malloc (Andres)

https://craftinginterpreters.com/scanning-on-demand.html

Matching wildcards

https://www.geeksforgeeks.org/wildcard-pattern-matching/

Algorithms for parsing

https://en.wikipedia.org/wiki/Shunting_yard_algorithm https://eli.thegreenplace.net/2012/08/02/parsing-expressions-by-precedence-climbing https://www.cs.purdue.edu/homes/grr/SystemsProgrammingBook/Book/Chapter5-WritingYourOwnShell.pdf

Parsing Techniques A Practical Guide History of Parsing methods

Collaboration

Github Guide on Collaboration Jonathan Mines Github Collaboration Guide

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published