PySh
Why another shellAnother shell can run anywhere Python exists.
Supported shell featureBecause it"s fun.
Common shell features can be found here. Pysh already have:
|, Pipe output
$var, Use value for variable
" ", double quote (allows variable and command expansion)
Usagegit clone https://github.com/jiacai2050/pysh.git cd pysh python -m pysh.shell ## Demo > ls .git .gitignore .pre-commit-config.yaml assets pysh README.md > echo $HOME /Users/liujiacai > echo ${JAVA_HOME} /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home > pwd /Users/liujiacai/codes/python/pysh > cd .. /Users/liujiacai/codes/python > pwd /Users/liujiacai/codes/python > cat /etc/hosts | grep 127.0.0.1 127.0.0.1 localhost > grep 127.0.0.1 /etc/hosts 127.0.0.1 localhost
Supported commands can be found here.
More commands are on the way. PR welcomed !
Have fun ?
How PySh workA shell in unix box is a bridge bewteen user and the kernel through system call.
As we can see from above picture (taken from here), some commands (eg ls, cat) are passed to other programs, while built-in commands (eg cd, exit) are executed inside shell. This way can keep shell small in size and strong in function.
In order to let PySh run anywhere (hi, Windows, I mean you), PySh implmented all commands in its core, so there is no differences bewteen builtins and one that is not, also you can say all commands are builtins.
One thing I should mention here is:
Pipelines between different commands are supported by generator in Python.
So, every command should yield something, this is like s-expression in Lisp world, where every s-expression should return a value.
How to contributePySh use pre-commit to ensure code quality, so you should install it before contribute.
Fork and PR ?
文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。
轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/38072.html
Building virtual reality experiences on the web with React VR Over the past year, virtual reality has made major strides toward becoming the next computing platform. With Oculus Rift, consumer-grade h...
摘要:持有雞的人是唯一被允許談話的人。這樣可以確保人們互不說話,也有自己的空間。所以當作業第一次啟動時,創建一個互斥,然后每次作業運行時,它檢查互斥是否存在,只有在沒有工作的情況下運行。 譯文GitHub https://github.com/yuansir/diving-laravel-zh 原文鏈接 https://divinglaravel.com/task-scheduling/pr...
In official Doc. of Python 3, there is a short introduction to embedding Python in another application like C/C++ (seeEmbedding Python in Another Application). The common procedure is as follows, w...
閱讀 894·2021-09-03 10:42
閱讀 1511·2019-08-30 15:56
閱讀 1444·2019-08-29 17:27
閱讀 870·2019-08-29 15:25
閱讀 3157·2019-08-26 18:27
閱讀 2480·2019-08-26 13:41
閱讀 1888·2019-08-26 10:39
閱讀 1570·2019-08-23 18:36