Simple shell for Unix-like systems written in C
Find a file
Aleksandr Lebedev db5aef12c2 PS1 variable support, ~ expansion and pretty pwd
- if arsh has a PS1 env var, it will use it to display prompt. It
supports esc sequences, \u, \w
- if '~' is used, it will be expanded to $HOME env var value
- if PS1 env var uses \w, and $PWD is somewhere inside $HOME, then it
will show '~' in prompt instead of a long path
- arsh sets $SHELL env var on startup
2026-04-21 01:36:40 +02:00
.gitignore Initial commit 2026-02-19 14:18:59 +01:00
LICENSE Initial commit 2026-02-19 14:18:59 +01:00
main.c PS1 variable support, ~ expansion and pretty pwd 2026-04-21 01:36:40 +02:00
README.org Updated README 2026-02-20 01:40:30 +01:00

arsh - ARchaic SHell

Simple shell for Unix-like systems written in C, that has a funny name (for germans).

Features

  • Can run commands
  • You can pipe stdout of one command to stdin of another (ex. cat main.c | wc --lines)
  • Variables expansion with $PATH and ${HOME} syntax
  • Run subcomands with $(hostname) or `pwd` (works with pipes)
  • cd builtin command (cd without arguments moves you to $HOME)
  • exit builtin command
  • CTRL+C stops running command
  • Custom readline function
  • Run scripts with arsh /path/to/script or by putting #!/usr/bin/env arsh at the first line of a script and making it executable
  • Run commands with arsh -c 'echo $PATH' to launch something quickly with arsh.

Build

To build it, you don't need any external dependencies. Example with gcc:

gcc main.c -O3 -o arsh