Skip to content
/ 42sh Public

Custom Unix Shell wrote in C inspired by tcsh.

Notifications You must be signed in to change notification settings

neo-jgrec/42sh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Custom Unix Shell wrote in C inspired by tcsh.

Resources

Stars

Watchers

Forks

Packages

No packages published