Skip to content

Latest commit

 

History

History
134 lines (96 loc) · 2.15 KB

File metadata and controls

134 lines (96 loc) · 2.15 KB

pynix.sh

pynix is a Python-powered, cross-platform shell. The language is a superset of Python 3 with seamless shell command integration.

pynix is the Shell pynix is Python
cd ~

whoami > /tmp/user.txt

cat /etc/passwd | grep root

ls -la
2 + 2

var = "hello".upper()

import json
json.loads('{"a":1}')

[i for i in range(0, 10)]
pynix is the Shell in Python pynix is Python in the Shell
len($(curl -L https://example.com))

result = !(ls /tmp)
print(result.returncode)

x = $(whoami)
echo "User: @(x)"
name = 'mosalah'
echo @(name) > /tmp/@(name)

files = ["a", "b", "c"]
for f in files:
    $(touch @(f).txt)

def greet(name):
    return f"Hello, {name}!"
echo @(greet("world"))

If you like pynix, ⭐ the repo!

First steps

Installation:

pip install pynix.sh

Launch:

pynix

Builtins

Command Description
cd Change directory
pwd Print working directory
echo Print arguments
type Show command type
history Show command history
exit Exit the shell
about Display help for builtins
activate Activate Python virtualenv
deactivate Deactivate virtualenv

Operators

Operator Description Example
@(expr) Expand Python expression echo @(2 + 2)echo 4
$(cmd) Capture stdout x = $(whoami)
!(cmd) Capture CommandResult r = !(ls); print(r.returncode)
&& Run if previous succeeded true && echo yes
|| Run if previous failed false || echo no
; Sequential execution x = 1; echo @(x)
| Pipe echo hi | grep h

Contributing

We welcome contributors! The codebase is small and focused. Start with:

  • Running the test suite: python -m unittest discover -s tests
  • Reading the architecture in app/core/
  • Report bugs, suggest features

License

MIT