Skip to content

42shell/42sh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

fca4698 · Nov 22, 2020
Nov 20, 2020
Oct 15, 2020
Nov 20, 2020
Nov 16, 2020
Sep 15, 2020
Oct 1, 2020
Oct 21, 2020
Jan 28, 2020
Nov 16, 2020
Nov 22, 2020
Jan 17, 2020
Apr 22, 2020
Feb 7, 2020
Dec 17, 2019

Repository files navigation

42sh

Build Status codecov Codacy Badge Coverity Scan analysis

This is a school project, which is why some formatting decisions may be questionnable (namely, we can't have more than 5 functions per file or 25 lines per function).

An advanced unix shell coded entirely from scratch with the following features:

  • Line editing:

    • Made from scratch, we implemented our own readline using the termcap library
    • Readline shortcuts CTRL-U, CTRL-Y, CTRL-K, CTRL-W
    • Line history
  • Simple commands execution:

    • ; and & control operators
    • All POSIX basic input/output redirections: >, <, >>, <<, |
    • Logical operators && and ||
    • Useful builtins (cd, echo, exit, hash, type)
  • Environment management and parameter expansion:

    • Special parameters
    • Internal variables
    • Full quote support: ", ', \
    • Field splitting
    • Associated builtins (env, set, unset, export)
  • Advanced expansion features:

    • Pattern matching (* [a!bc-e])
    • Arithmetic expansion with $((...))
  • Contextual autocompletion:

    • Command autocompletion (binaries and builtins)
    • Command options autocompletion
    • Variables, files and directories autocompletion
  • More advanced command syntax and features:

    • Subshells, command grouping with (...) and {...}
    • Command substitution with $(...)
    • Process substitution with <(...) and >(...)
  • Full job control support:

    • Signal handling
    • Full tracking of all processes launched by the shell (IDs, statuses, exit codes)
    • Basic builtins to interact with the processes (jobs, fg, bg)
  • And more:

    • Non interactive mode, allowing you to write scripts in a file and give it as an argument to the program
    • More than 400 automatic tests, using script and scriptlive to test interactive mode features like autocompletion and job control
    • Thoroughly bug-tested using AFL