3 ms·
IPython as a Replacement for Bash (on a Mac)
- rflrob 16y agoHaving to use a ! for every system command is a dealbreaker for me. Honestly, it would be a dealbreaker even if you only had to do it once per line, but multiples is just too cumbersome to be a good replacement for bash. If there were some way to put it in "shell mode", where you could avoid that, and perhaps use bang for "this line is now python", that might be okay. EDIT: I think I misunderstood what he was saying about multiple !'s. I still think ! is too cumbersome to use in front of commands by default, though. Also, when you use !, you don't have any way to test whether a call has run properly (i.e., no $? that I can figure out)
- tmsh 16y agoThat would've been a dealbreaker for me too. I'll update the post to try to make it clearer. When you run 'ipython -p sh' or include 'import ipy_profile_sh', by default everything will be in 'shell mode'. I'm not too sure, but I think it basically parses the first command and determines if it's in the IPython set of commands/value namespace, and if not runs it in the shell...
- viraptor 16y agoThere is shell mode - maybe not obvious from the article. Run ipython with: ipython -p pysh and you'll get pysh "profile". It's a shell and python environment merged together. This way you don't have to use bangs. > ls -> (output of ls) > ls | grep x -> (output of grep) > res = !ls > res? Type: SList Base Class: <class 'IPython.genutils.SList'> ...
- technomancy 16y agoThis is one thing eshell handles really well. If you type foo, it will first search for an elisp function called eshell/foo before falling back to a foo Unix command, but if your input begins with a paren, then it's executed as lisp.