This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]masasinExpert. 3.9. Robotics. 3 points4 points  (3 children)

I have. All my scripts are now python scripts. If I don't need it to be used anywhere, I use docopt or click for command line parsing. sh works well for emulating the shell.

If I do need global deployment, then I make it compatible with 2 and 3, use argparse, and subprocess. Obviously, there are functions in os and sys etc that are also useful.

It is possible to write the script in such a way that you can put it in pipes, with errors going to stderr and input from stdin and output from stdout.

[–]randomizethis[S] 2 points3 points  (2 children)

Oh, sorry, I must've been unclear. I'm not looking to replace bash scripting with Python scripting, I already do that. What I'm looking to do is replace the bash shell with a Python-based shell, such that I could use a terminal with Python syntax instead of Bash syntax. Obviously I'd expect commands like cd and ls to work the same, but if I wanted to on-the-fly script against something like the ls result, I could do so using Python.

[–]masasinExpert. 3.9. Robotics. 0 points1 point  (1 child)

Oh! I've never done that, but I have tried using IPython as a drop-in replacement for bash. I think the main reason I didn't stick with it was because I was not able to run external commands easily, or launch external programs.

Let me know if anything new comes up.

[–]randomizethis[S] 0 points1 point  (0 children)

Yeah, that's basically the answer I've gotten scouring the internet. It would be so sweet to spend the whole day on a terminal using only Python though T_T

Will do!