ysh
A shell completely written in C. Supports bg/fg jobs, ';
' separated list of commands, io redirection, pipes, escaping quotes and more.
Features
The following shell builtins were implemented:
- cd (supports absolute / relative paths)
- pwd
- echo
- history (stored last 20 commands, accessible with the up arrow)
- exit
- pinfo (gives detailed info about any process given it's pid)
- ls (yes, it was implemented again, supported '-a' and '-l' flags)
- {un}setenv (allowed removal and creation of environment variables)
- jobs (like ps)
- kjob (sends a signal to a process)
- fg / bg (moves a process to foreground or background)
- overkill (stops all background processes)
- ... (and some more)
Any external command was executed using the exec
syscall
The following features were implemented:
- semicolon(;) seperated list of commands can be passed, whitespace is ignored
- Execution of system commands with or without arguments, in background or foreground
- Notifying when and how the background process terminated
- Input and output redirection, including appending to a file
- Piping of commands
- Handling SIGINT [C-c] and SIGTSTP [C-z] signals
- Command recall using up arrow key
- echo supports printing environment variables
- Spaces are escaped within quotes. i.e., vim "bad name.txt" will work as expected
· · ·
Image(s)
· · ·
Code
The code, along with instructions to build and use it can be found on github, at yoogottamk/ysh.