/42sh

42sh : shell implementation from scratch with 0 libraries.

Primary LanguageC

42sh

Subject:

Subject

Mandatory part:

  • Prompt without line edition.
  • Builtins cd, echo, exit, env, setenv, unsetenv with there options.
  • Executing simple commands with there parameters using PATH.
  • Support for redirection >, >>, <and |.
  • Logical operand &&and ||.
  • Separator ;.

Optional feature (five of theses are mandatory to validate the project):

  • Inhibitors ", 'and \.
  • Advanced redirections: aggregation of file output and heredoc <<.
  • Globbing: *, ?, [], {}, etc.
  • Backquotes `.
  • Subshell with operand ().
  • Local variable and builtin unset and export.
  • History with builtin historyand ! with options.
  • Advanced line edition.
  • File descriptors and builtin read with options.
  • Dynamical autocompletion.

Optional feature highly appreciated:

  • Job Control and builtins job, fg, bg and operand &.
  • Shell Scripting: bang (!), variable assignements, brace group, if, while, until, for and functions

Bonuses

  • Bc like command with calc
  • History search with CTRL+H
  • Can perform arithmetic operations on local variables assignment
  • Can search binary name with approximation (like which)
  • Replacement of ~ by $HOME
  • Replacement of any environment variable with the value of the variable.
  • Binary hashtable
  • Rights in the PATH
  • Custom ctrl-v to handle multi-line copy and paste
  • Lot of shortcut for line edition like
    • CTRL+T Change the position of the characters
    • CTRL+U Delete the entire line
    • CTRL+K Delete from cursor to the end of the line
    • CTRL+W Delete the last word typed
    • CTRL+L Clear shortcut
    • SHIFT + Up cursor
    • SHIFT + Down cursor
    • SHIFT + Go to right word
    • SHIFT + Go to left word
    • And other conventional shortcut !