Skip to content

2️⃣1️⃣ Our own Bash-like shell. Editor features, context-aware auto-completion, pipes, redirection, global clipboard, built-ins, history etc. Made from scratch with system calls. GIF in README

Notifications You must be signed in to change notification settings

tuommii/21shell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

21shell - Our own shell

This was a big, challenging and the most time-consuming project that Hive Helsinki currently offers to us. See also restrictions we had. Developing continues on a different repository.

───────────────────────────────────────────────────────────────────────────────
Language                 Files     Lines   Blanks  Comments     Code Complexity
───────────────────────────────────────────────────────────────────────────────
C                          155      8124      745      1970     5409       1509
C Header                     8       883      120       151      612          0
Makefile                     2       254       27        11      216          0
Markdown                     2       153       22         0      131          0
Python                       2       315       12         1      302         21
gitignore                    2        15        0         0       15          0
───────────────────────────────────────────────────────────────────────────────
Total                      171      9744      926      2133     6685       1530
───────────────────────────────────────────────────────────────────────────────
Estimated Cost to Develop $198,587
Estimated Schedule Effort 8.300657 months
Estimated People Required 2.833962
───────────────────────────────────────────────────────────────────────────────

Features

  • Dynamic Context-Aware Autocompleter
  • Multiline support
  • History
  • Global clipboard with support of OS X and Linux (xclip)

Try It (OS X and Linux)

On Linux you might need to install xclip and termcaps with (Debian-based distros):

sudo apt-get install libncurses5-dev xclip

Compile and run with:

make
./21sh

Unittests

python3 test-suite/tests.py

Keyboard shorcuts

KEY ACTION
CTRL + LEFT Moves cursor one word left
CTRL + RIGHT Moves cursor one word right
CTRL + UP Moves cursor one row up
CTRL + DOWN Moves cursor one row down
HOME Moves cursor to beginning of input
END Moves cursor to end of input
DELETE Delete char at cursor position
CTRL + L Clear screen
CTRL + U Clear input
CTRL + D Delete char at cursor, exit if no input
CTRL + W Cut from start to cursor
CTRL + E Cut from cursor to end
CTRL + A Yank, internal paste
CTRL + K Copy. Copy current input to clipboard
CTRL + P External Paste
LEFT Moves cursor left
RIGHT Moves cursor right
UP Get next command from history
DOWN Go back one command
BACKSPACE Delete on char left of cursor and move cursor left
ESC Quit

Restrictions

  • Max 25 lines per function
  • Max 5 functions per .c file
  • Comments are only allowed outside of functions
  • All defines, and typedef must be done in header files
  • No leaks
  • No unexpected quits

Allowed functions

malloc, free
access
open, close, read, write
opendir, readdir, closedir
getcwd, chdir
stat, lstat, fstat
fork, execve
wait, waitpid, wait3, wait4
signal, kill
exit
pipe
dup, dup2
isatty, ttyname, ttyslot
ioctl
getenv
tcsetattr, tcgetattr
tgetent
tgetflag
tgetnum
tgetstr
tgoto
tputs

Bonus

This is what the shell looked like when development started

About

2️⃣1️⃣ Our own Bash-like shell. Editor features, context-aware auto-completion, pipes, redirection, global clipboard, built-ins, history etc. Made from scratch with system calls. GIF in README

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published