Skip to content
Madvith-dPublic

About

Linux Shell implementation in C++

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

novash

novash is a lightweight Linux shell implemented in C++17. It provides an interactive prompt when attached to a terminal and can also execute scripted command input through standard input.

Implemented features

The shell now supports the core features that were previously missing:

Area Supported behavior
Process execution Commands found through PATH, exit-status propagation, useful errors for missing or non-executable commands
Pipelines Arbitrary-length pipelines such as `cat file
Command lists ;, background &, conditional &&, and conditional `
Redirection Standard input <, output overwrite >, output append >>, combined output &>, and descriptor duplication such as 2>&1
Parsing Single and double quotes, backslash escaping, comments beginning with #, and environment-variable expansion using $NAME or ${NAME}
Globbing Filename expansion for *, ?, and bracket patterns
Built-ins cd, pwd, export, unset, env, echo, true, false, help, and exit
Prompt Current directory display with the home directory abbreviated as ~

Stateful built-ins are executed in the parent shell process when they are used as standalone commands, so commands such as cd, export, and unset persist for later input lines. Built-ins used inside a pipeline execute in the pipeline child process, matching normal shell behavior.

Build

GNU Make

make
./novash

CMake

cmake -S . -B build
cmake --build build
./build/novash

The project requires a C++17 compiler and uses only standard library and POSIX system interfaces.

Examples

# Pipelines
printf "one\\ntwo\\n" | grep two

# Conditional execution
make && echo "build succeeded" || echo "build failed"

# Redirection
cat input.txt | grep warning > warnings.txt
command 2>&1 | less

# Shell state
cd /tmp
export NOVASH_MODE=debug
echo "$NOVASH_MODE"

Tests

Build the executable, then run the regression suite:

make
python3 -m unittest discover -s tests -v

The tests cover pipelines, quoting, parent-shell built-in state, redirection and append behavior, conditional command lists, background commands, syntax errors, and stderr-to-pipeline redirection.

Notes

novash is intentionally a compact shell rather than a full POSIX shell. It does not currently provide job-control signals, command history, shell functions, command substitution, or multiline interactive heredoc input. Unsupported syntax is reported rather than silently treated as a normal argument.

About

Linux Shell implementation in C++

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages