https://github.com/sped0n/zh
A toy POSIX shell written in Zig.
https://github.com/sped0n/zh
shell ziglang
Last synced: about 2 months ago
JSON representation
A toy POSIX shell written in Zig.
- Host: GitHub
- URL: https://github.com/sped0n/zh
- Owner: Sped0n
- License: mit
- Created: 2025-02-04T08:32:58.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-08T03:23:50.000Z (over 1 year ago)
- Last Synced: 2025-10-04T16:40:55.946Z (9 months ago)
- Topics: shell, ziglang
- Language: Zig
- Homepage:
- Size: 102 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# zh
A toy POSIX shell written in Zig.
```
$ echo \'\"hello world\"\'
'"hello world"'
$ gc
gc gcc gcc-13 gcc-14 gcc-ar-13 gcc-ar-14 gcc-nm-13 gcc-nm-14 gcc-ranlib-13 gcc-ranlib-14 gcore gcov gcov-13 gcov-14 gcov-dump-13 gcov-dump-14 gcov-tool-13 gcov-tool-14
$ type gcc
gcc is /usr/bin/gcc
$ type ls
ls is /bin/ls
$ ls
LICENSE build.zig zig-out
Makefile build.zig.zon
README.md src
$ cd ..
$ pwd
/Users/spedon/eden/zig
$ cd zh
$ pwd
/Users/spedon/eden/zig/zh
$ ls > test.txt
$ cat test.txt
LICENSE
Makefile
README.md
build.zig
build.zig.zon
src
test.txt
zig-out
$
```
## Features
* Builtins: `exit`, `echo`, `type`(with HashMap)
* Natigation: `pwd`, `cd`(*absolute* and *relative*)
* Quote Parsing(*State Machine*)
* Redirection to `stdout` or `stderr`
* Auotocompletion powered by Trie