Giter VIP home page Giter VIP logo

42sh's Introduction

42sh

The project consist to write a Unix SHELL.

It have two sections to achieve:

  • a mandatory section, which MUST be completed: display a prompt, parse and execute some commands (see below),
  • an optional section, which will only be evaluated if the mandatory section is fully functionnal.

Authorized functions: all functions included in the libC nor the ncurses library.

The 42sh is a shell that mimic the tcsh shell in it's behavior. For example, it followed the sames errors messages and parsing rules. (We're using tcsh version tcsh 6.24.07 (Astron) 2022-12-21)

Requirements of the project

Mandatory section

This section must be COMPLETELY FUNCTIONAL, otherwise the project will be considered non functional and will receive a 0 grade.

  • spaces and tabs,
  • $PATH and environment,
  • errors and return value,
  • redirections (‘<’, ‘>’, ‘<<’ and ‘>>’),
  • pipes (‘|’),
  • builtins: cd, echo, exit, setenv, unsetenv,
  • separators: ‘;’, ‘&&’, ‘||’.

For instance, you should be able to execute the following command:

∼/B-PSU-210> ./42sh
42sh> cd ; </etc/hosts od -c | grep xx | wc >> /tmp/z -l ; cd - && echo “OK”

Optional section

The most of your points you can get for the project are from this section. This project is free-rein and can do what you want. However, the entire project’s coherence will be taken into consideration. Once more, stability will be much more important that quantity. An option that will cause a problem for the rest of the program (especially for the mandatory section!) will make you lose a lot of points.

Here is a list of desired extras:

  • inhibitors (‘\’),
  • globbings (‘*’, ‘?’, ‘[’, ’]’),
  • job control (‘&’, fg),
  • backticks ("`"),
  • parentheses (‘(’ and ‘)’),
  • variables (local and env),
  • special variables (term, precmd, cwdcmd, cwd, ignoreof for instance),
  • history (‘!’),
  • aliases,
  • line edition (multiline, dynamic rebinding, auto-completion dynamic),
  • scripting (a bit harsh though).

These extras are not bonuses! Bonuses will be evaluated only after every item on this list have been correctly implemented.

Needed packages to compile the project

  • gcc
  • make

How to compile the project

  • Clone the repository
  • Run make in the root of the repository
  • Run ./42sh
  • Enjoy

How to use the shell

  • Run ./42sh
  • Type a command
  • Poof magic

Dependencies

RepoCard

42sh's People

Contributors

neo-jgrec avatar maxencelgt avatar yannmorvan avatar diaboloab avatar mlargeot avatar

Watchers

 avatar

42sh's Issues

History

History management :

  • Add command to history list every time execute function is call
  • Having only 100 element or less in list
  • Display list when "history (flag)" is enter and execute command when "!" is use.
  • For the display display like this without flag : number / time / command
  • If more than 100 elms in list when new command is execute -> remove head, add to tail (lst size == 100)
  • when "!!" is use change the number of tail +1

All tcsh builtins may to implement

: @ alias
alloc bg bindkey
break breaksw builtins
case cd chdir
complete continue default
dirs echo echotc
else end endif
endsw eval exec
exit fg filetest
foreach glob goto
hashstat history hup
if jobs kill
limit log login
logout ls-F nice
nohup notify onintr
popd printenv pushd
rehash repeat sched
set setenv settc
setty shift source
stop suspend switch
telltc termname time
umask unalias uncomplete
unhash unlimit unset
unsetenv wait where
which while

Call to env var

Use env var in shell, by using $PATH for exemple echo $PATH print the whole path stocked in the env

Quotes handle

Add of the quotes to handle, for example, everything between quotes mustn't be formatted

Binary recognision

On writing tests/my_ls it execute my_ls instead of writing "Command not found"

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.