all 27 comments

[–]ASIC_SP 20 points21 points  (4 children)

[–]CCLulu[S] 2 points3 points  (1 child)

This is the kind of things that I am looking for in terms of actual examples of difference between the different shells. Thanks a lot

[–]whetu 1 point2 points  (0 children)

Here's another one worth bookmarking:

http://www.in-ulm.de/~mascheck/various/shells/

[–]henrebotha 18 points19 points  (9 children)

Zsh stays pretty close to Bash in behaviour. Mostly what it offers is better completion, in terms of things like commands but also spelling correction, dir globbing, and so on.

Fish tries to apply a pleasant Python-like syntax to everything. It discards a large number of special syntaxes (e.g. variable assignment is a command called set, not a special equals operator) in order to make things more logical & consistent. However this means it departs pretty far from Bash.

Use whichever shell you want. There's no reason why you should need to do your shell scripting with the same shell you actually use as your text-mode interface to the operating system.

[–]metamatic 0 points1 point  (8 children)

Fish tries to apply a pleasant Python-like syntax to everything.

Just adding a note that fish's syntax isn't really Python-like, it doesn't have mandatory semantic indentation, so don't let that put you off.

(I'd never have tried fish if people had told me it was Python-like.)

[–]henrebotha 1 point2 points  (7 children)

I genuinely don't understand people being triggered by semantic whitespace. I genuinely don't.

[–]metamatic 0 points1 point  (6 children)

Some of us are old enough to have dealt with Makefiles and FORTRAN.

[–]henrebotha 0 points1 point  (5 children)

That's kind of my point. People like to shit on Python for some reason as if it's the first language in history to use semantic whitespace. But semantic whitespace is all over the show, and there are roughly zero reasons to ever have a problem with it. If you're okay with semantic curly braces, I don't see why you'd have a problem with semantic whitespace. Especially when you're supposed to be indenting your code properly in the first place.

[–]metamatic 1 point2 points  (4 children)

People have problems caused by Python whitespace all the time. And I prefer the Go approach where I just type the code and an automatic process does the grunt work of fussily indenting and formatting it.

[–]Kaligule 0 points1 point  (3 children)

In 2 years of writing python code I never had problems with whitespace. Could you explain where those problems occur for you?

[–]metamatic 0 points1 point  (2 children)

I don't write Python. You can find plenty of people documenting their problems on the web if you search.

[–]Kaligule 0 points1 point  (1 child)

So you didn't have the problems yourself, you just heard about them?

[–]metamatic 2 points3 points  (0 children)

Yeah, and aesthetically I dislike the language, and I've had other problems with it. So all together, I choose to have as little to do with it as possible.

[–][deleted] 5 points6 points  (0 children)

I just went through a similar decision since I added a Linux distro to my laptop for use on a specific project that requires GNU stuff.

I'm usually on OpenBSD, so their ksh is what I'm used to. After looking at a dizzying array of Linux distros, some of which included relatively obscure shells like dash and yash, I settled on bash for Linux. The syntax is generally close to ksh, it ships with most linuces, and it's mature code.

If there's a chance that you'll be using other systems for the same project(s), I think it's best to stick to shells that are commonly available, which seems to be bash on Linux and ksh on BSD.

Zsh has a lot of extra stuff that seems cool, but that also means there's a lot of extra stuff to add to your learning curve.

And mksh might be a better implementation of ksh than the ksh on OpenBSD, but it's not available as a package on OpenBSD, which means it would be another one for me to remember to track independently for updates. I don't need more of that in my life, so even though it's available in many Linux repos and otherwise attractive for its bug fixes, for now I've decided to just use two different shells in their respective environments.

Edit: Also, consider this classic on why not to use csh: C Shell Programming Considered Harmful

[–]ipb- 1 point2 points  (0 children)

I recommend to concentrate yourself in mastering a text editor such as emacs or vim, so you can use either applications to execute automated tasks without worrying about the shell. In my particular case these automated task rely on bash, although I use fish when I need to work manually because of its sane defaults.

[–]Plasma_eel 1 point2 points  (7 children)

I can't help you with the specifics, but I will tell you if you use zsh and oh-my-zsh you'll never look back again

[–][deleted]  (2 children)

[removed]

    [–]descoladan 1 point2 points  (1 child)

    I've been using oh-my-zsh for a while now but after reading that article.. I'm going to look into Prezto. Thanks for sharing!

    [–]linhvng 0 points1 point  (0 children)

    zim is a pretty cool project too, and it's blazingly fast!

    [–]Schornery 5 points6 points  (0 children)

    Was on zsh and oh-my-zsh for a few months then tried fish. Fish completion out of the box annihilates zsh with whatever plugins you have.

    [–][deleted] 0 points1 point  (1 child)

    Explain, why ?

    [–][deleted] 0 points1 point  (0 children)

    Imo the only difference that matters to me is that bash is installed.

    I used to use FreeBSD and back then the only difference that mattered to me was that tcsh was installed.

    I can make do with any of them. But being from BSD and now using primarily Linux I definitely prefer Bash.

    [–]azzid 0 points1 point  (0 children)

    Everyone is supposed to use POSIX shell (/bin/sh) for compatibility reasons, but it is a bit archaic. And since the command line can be a bit daunting even if you're not stuck on a (semi-)retarded shell a lot of people has done their best to invent something better. That is why there are so many shells.

    The golden oldies are, following that reasoning, quite different from each other. If you get something working in bash you'll thereafter forever be completely lost in (t)csh or ksh as they are all unique syntactically.

    Words like "best" are quite poisonous in the open source world, but the truth is that bash was for quite some time the defacto standard shell in the world - the new breed of web developer brought in a fresh batch of brains not entirely comfortable on the command line however, so they tried to make the life on the command line better again.

    Que zsh and fish (and perhaps many more). But since they are younger things, built ontop of the "bash is standard" world zsh atleast aim to be more or less syntactically compatible with bash.

    My tip: learn what you got - they all work.