8 ms·
Is there a better shell? By which I mean more flexible, more consistent, and simpler. (Anyone who says 'zsh' is disqualified.) I've briefly looked at rc, but w
by david-given 11y ago
Is there a better shell? By which I mean more flexible, more consistent, and simpler. (Anyone who says 'zsh' is disqualified.)
I've briefly looked at rc, but while it's significantly simpler and more orthogonal than sh it's got it's own weirdnesses; but the 'Design Principles' section here is worth reading: http://plan9.bell-labs.com/sys/doc/rc.html http://plan9.bell-labs.com/sys/doc/rc.html
Surely there must be a usable shell wrapped around an actual modern language?
- traverseda 11y agoI like xonsh. http://xonsh.org/ http://xonsh.org/ It has two modes, which can be a bit confusing. A python mode and a bash-ish mode. testdata = $(ls -l) #Takes thes bash command 'ls -l' and saves it to the python variable testdata echo ${testdata.upper()} | grep XLIO $(ls).split("\n") It uses some magic to figure out whether you're in a python context or a bash context, defaulting to python. If you save some stuff to a variable called "ls", you need to del(ls) before you can use ls as a command again.
- toothbrush 11y ago> Anyone who says 'zsh' is disqualified. I'm curious as to why you say that? This is a naive question, i have no skin in the game.
- david-given 11y agozsh is really powerful and flexible, but it does so by being really, really complicated --- it's basically taking bash and turning all the weirdness and bizarity up to 11. It's an uber-bash, which is very much the opposite of what I'm looking for.
- useerup 11y ago> it's basically taking bash and turning all the weirdness and bizarity up to 11 While I certainly understand where you are coming from, I have found that zsh may be more complicated, but less "weird" (i.e. it is more consistent) However, zsh is tons of tons of special cases that may be mostly consistent, but without any clear concept which would allow you to remember or deduce solutions. When you are a zsh wizard you can be really productive, but it is a strange skillset that takes time to achieve and require constant refresh. IMHO the closest thing zsh has to a "concept" is that if it takes too many characters, then there's probably a special case which - if you knew it - could solve the problem in a shorter form.
- klibertp 11y agoZsh is largely compatible with bash's quirks, and then layers lots of weird things of its own on top of that. ZSH is a great, very powerful shell which I use and enjoy, but it's not any of: "simple", "consistent", "fast" or "lightweight".
- toothbrush 11y agoOK. Fair enough. I use zsh (only scratching the surface) because years ago it turned out that the completion "seemed" to me to be much more powerful (e.g., fuzzy matching, substring matching, etc.), but i haven't invested time to become a wizard. Do you (or anyone else here) endorse a shell which is worth becoming a wizard in? I'm thinking perhaps eshell or simply zsh-in-M-x-shell is perhaps a good starting point, but somehow that's always felt awkward to me, notably because completion seemed to be weaker than simply xterm+zsh.
- klibertp 11y agoDon't go the eshell route unless you're prepared to learn Elisp very well and then write a ton of custom Elisp code. Take a look at its documentation: > Eshell is _not_ a replacement for system shells such as ‘bash’ or ‘zsh’. Use Eshell when you want to move text between Emacs and external processes; if you only want to pipe output from one external process to another (and then another, and so on), use a system shell, because Emacs’s IO system is buffer oriented, not stream oriented, and is very inefficient at such tasks. If you want to write shell scripts in Eshell, don’t; either write an elisp library or use a system shell. And yes, I never managed to make auto-completion work really well in M-x shell (or eshell). One possible shell env you might be interested in is IPython. It's a Python REPL with support for launching external programs, shell-like variable substitution and much more. Coupled with qtconsole it makes for a great shell-like experience. I was using IPython under Windows as my shell for awhile, before switching to PowerShell.
- useerup 11y ago> Is there a better shell? By which I mean more flexible, more consistent, and simpler. Yes, PowerShell. And it may actually arrive at Linux/Unix soon, due to CoreCLR. The specification is already open, but until now not much progress has been made towards bringing it uncrippled to Linux/Unix PowerShell is extremely consistent. Examples: All commands are strictly on the verb-noun form where there are only 40 or so "approved" verbs. Noun represent the topic, so if you are working with ACLs, the commands are Get-Acl, Set-Acl, and if you are working with network network adapters, the commands are Disable-NetAdapter, Enable-NetAdapter, Get-NetAdapter, Rename-NetAdapter, Restart-NetAdapter, Set-NetAdapter. All (PowerShell) commands require the parameters in the same way (no - and -- confusion) as it is actually the shell that does the parameter parsing. The grammar is "modern" so it has no surprises for anyone used to context-free grammars (like C, Python, Java, ...). PowerShell is certainly flexible as it comes with the ability to invoke anything that has an exposed .NET API, or even has a WBEN/CIM standard interface (like some network switches etc).
- nimrody 11y agoCan you recommend a resource for learning powershell? (Assuming one has UNIX background) [it does generate annoyingly long error messages!]
- useerup 11y agoLong error messages: Yes, they can be a little strange at first. If they annoy you (or you want errors to cause a little less scrolling) you can set the "error view": $ErrorView = "CategoryView" (unlike bash, whitespace is not significant) As for learning PowerShell, if you lean towards online training, Microsoft Virtual Acedemy has a really good series of courses, even featuring Jeffrey Snover - who is surprisingly good at explaining stuff. This is a good starting point: https://www.microsoftvirtualacademy.com/en-US/training-courses/getting-started-with-powershell-3-0-jump-start-8276 https://www.microsoftvirtualacademy.com/en-US/training-cours... I usually prefer books/articles etc where I can set my own pace, but those online courses are really that good. Otherwise links: * https://technet.microsoft.com/en-us/library/cc281945(v=sql.105).aspx https://technet.microsoft.com/en-us/library/cc281945(v=sql.1... * http://learn-powershell.net/ http://learn-powershell.net/ And let's not forget the very friendly community at http://powershell.org/ http://powershell.org/ with articles such as this one: http://powershell.org/wp/2015/07/31/introduction-to-powershell/ http://powershell.org/wp/2015/07/31/introduction-to-powershe...
- _yy 11y agoThere's fish: http://fishshell.com/ http://fishshell.com/ Also, a nice experiment: http://xonsh.org/ http://xonsh.org/ (Bash-alike with embedded Python)
- agentultra 11y agoI second fish. I've been using it as my primary shell for more than a few years now. The syntax is better than bash and familiar to those who've done programming in languages like Ruby or Python. The line editor is actually useful. It handles indentation and highlighting. It will display an appropriate help page if you mess up some command. It comes bundled with argument completion for most common Unix tools and is easy to extend for other programs. for file in (ls /home/me/mp3s); echo $file; end It will also highlight incomplete paths, bad syntax, etc, as you type. I know at a glance if I messed up a path or misspelled a program name. Really useful shell.
- EdiX 11y ago>Surely there must be a usable shell wrapped around an actual modern language? AFAIK, the answer is no. I've spent a bit of time thinking about this problem and my conclusion is that the things that make a shell nice to use interactively are the same things that make it bad as a programming language. Rc may be as close as we will ever get to it.
- agumonkey 11y agoImagine what if this one had been standard https://wryun.github.io/es-shell/manpage.html https://wryun.github.io/es-shell/manpage.html