-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Rituraj edited this page Jun 30, 2025
·
9 revisions
Pysh is a cross-platform shell and Python REPL hybrid supporting tab completion, concurrent pipeline chaining, redirection, and more.
It behaves like a basic shell and a live Python interpreter, all in one terminal.
CodeBerg: Mirror
$ cd
$ pwd
/home/user
$ echo \
> hi \
> out
$ tail -f out |
> head -n 1 |
> wc
1 1 3
$ ls |
> grep "p" &&
> echo "done"
Pipfile
Pipfile.lock
pysh
doneNote: On Windows, tab completion should always be used with commands because executables do not work without their file extensions.
$ import os
$ 2 + 2
4
$ def greet(name):
> print("Hello", name)
>
$ greet("World")
Hello World
$ l = [i * i for i in range(input("n: ")]
n: 5
$ l
[0, 1, 4, 9, 16]
$ path = os.path.join(os.getcwd(), "test.txt")
$ path
/home/user/test.txt| Feature | Description |
|---|---|
| Tab Completion | Auto-completes commands and builtins; supports Windows cmdlets and aliases |
| Multiline Input | Supports input continuation using quotes, brackets, line-end \, and colons |
| Command Chaining | Pipeline (|) support with proper tokenization and cross-command piping |
| Logical Operators | Supports \&\&, ||, and background \& operations |
| Persistent History | Session history saved and loaded via readline
|
| Output Redirection | Supports >, 2>, \&>, >> and variations for redirection and append |
| Quoted Argument Parsing | Custom tokenizer preserves quotes and handles escape sequences |
| Variable Substitution | Expands $VAR and ${VAR} within commands using current environment |
| Built-in Commands | Implements shell builtins: cd, pwd, echo, exit, history, type, etc. |
| Synchronous Execution | Avoids subprocess/thread complexity; all commands run in a single event loop |
| Portable Architecture | Uses only os, readline, and subprocess; no third-party libraries |
| Windows Compatibility | Recognizes and runs PowerShell cmdlets and aliases natively via $PATH
|
| Command | Description |
|---|---|
cd |
Change directory |
echo |
Print text |
exit |
Exit shell |
pwd |
Print current working directory |
history |
View or manage command history |
type |
Identify command type (builtin, bin) |
env |
Show environment variables |
unset |
Remove environment variables |
pip install git+https://codeberg.org/zz/PySh- Download pysh/main.py
- Double-click to run it, or launch via terminal:
python pysh/script.py
Pull requests, suggestions, and issue reports are welcome!