Experimental Python-based shell

  • Thread starter Jonathan Hayward
  • Start date
J

Jonathan Hayward

I've made an experimental Python-based Unix/Linux shell at:

http://JonathansCorner.com/cjsh/

An experimental Unix/Linux command line shell, implemented in Python 3, that takes advantage of some more recent concepts in terms of usability and searching above pinpointing files in heirarchies.

I invite you to try it.

Jonathan Hayward, (e-mail address removed), JonathansCorner.com
 
J

Jorgen Grahn

I've made an experimental Python-based Unix/Linux shell at:

http://JonathansCorner.com/cjsh/

An experimental Unix/Linux command line shell, implemented in Python
3, that takes advantage of some more recent concepts in terms of
usability and searching above pinpointing files in heirarchies.

I invite you to try it.

Hard to do without a manual page, or any documentation at all except
for a tiny "hello world"-style example ...

/Jorgen
 
P

Prasad, Ramit

(A little quoting manipulation to make it easier to read with
appropriate context.)

2012/10/3Jonathan Hayward said:
The chief benefit besides the searching, so far, is that you can use Py3k mixed with shell commands as the
scripting language--so script in Python instead of bash.

When using Python for scripting, Pythonlines are indented by an extra tab (or four spaces) while shell-like
commands are not indented. So:

cjsh>     forindex in range(10):
----> echo %(index)d
---->
0
1
2
[snip]

Echo could (and maybe should) be a built-in, but it isn't. The output is os.system()'ed to bash, which echoes
based on a command that includes the value of a Python variable. The implementation is a bit crude, but itis
reasonably powerful.

I have other things on the agenda, like making it able to run scripts and doing fuzzy matching, but for now
those are the main two attractions.


Is it possible to drop completly the bash syntax and use some python library (I saw it on github) that wraps
bash commands with python functions or the other around making it possible to call python functions with a bash-
like syntax. The syntax you are talking about seems strange.

Regards,

Amirouche

Jonathan said:
I am open to suggestions and patches. I don't think the syntax strange, though: it offers a clear and distinct
way to differentiate Python and shell commands, and shell commands can access Python variables when specified.
And it is a simple rule, without footnotes needed.

I need more footnotes. :) Does every shell command not have indentation?
How can you tell if the shell command is supposed to be in the loop or after
the loop?

for index in range(10):
# do something
echo %(index)d

Is the above equivalent to Python pseudo-code solutionA or B?

Solution A,
for index in range(10):
#do something
Popen('echo', file_path)

Solution B,
for index in range(10):
#do something
Popen('echo', file_path)

How do I make achieve the other solution?


This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracyand completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.
 
T

Terry Reedy

Indexing Python code is ugly. I suggest prefixing non-Python with $.

Indenting, meaning indenting the Python header lines but not non-Python
lines.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top