#+title: arsh - ARchaic SHell

Since I started using GNU/Linux, I always wondered, how do shells work and what exactly are they responsible for. 

In order to learn it (and also to learn some C) I decided to make a simple shell for UNIX-like systems in C and try to implement some of the features, that other shells like bash, zsh, fish, etc have. And also I wanted to have the whole source code in a single ~.c~ file, that uses no external dependencies, other than the standard C library.

* Features
Some of the implemented features are:
- You can pipe stdout of one command to stdin of another (ex. ~cat main.c | wc --lines~)
- You can redirrect output/input with ~>~, ~>>~, ~<~, ~2>~, ~&>~
- Variables expansion with ~$PATH~ and ~${HOME}~ syntax
- Shows custom prompt, if ~PS1~ env variable is set
- Run subcomands with ~$(hostname)~ or ~`pwd`~ (works with pipes)
- Custom ~readline~ function with support for cursor moving (<-, ->) and inline editing
- Run the shell in interactive and non interactive mode

* Source code
[[https://git.kylekrein.com/kylekrein/arsh][Forgejo]]
