Live data from Hacker News

How zsh is more useful than bash

slideshare.net

141–150 of 151 posts

Re: How zsh is more useful than bash

#141

I use bash as my everyday shell since 1996. I keep on reading the "how great zsh is" articles. And I always try zsh. But after a few minutes/hours, I go back to bash. It's really hard to change.

Just using zsh as a drop-in replacement for bash is pointless. You'd need to discover its features and customize it to get added value. As a simple example, in bash if you use tab completion and there are multiple options, pressing tab again just reminds you that there are multiple options accompanied by a passive aggressive beep (it used to be this way at least). zsh lets you cycle through the possible completions.

> As a simple example, in bash if you use tab completion and there are multiple options, pressing tab again just reminds you that there are multiple options accompanied by a passive aggressive beep

This should fix it in bash: bind '"\t":menu-complete'

Re: How zsh is more useful than bash

#142
post #117

I really enjoy the regex completion. Example: $ rm * .gch dir/* .gch $ rm file1.gch file2.gch file3.gch file4.gch dir/file5.gch I really enjoy it when I'm removing something sensitive and just want to make sure.

In bash, you can use 'C-M-e' to expand just like the shell.

Re: How zsh is more useful than bash

#143

Earlier quoted context omitted.

I use zsh on ubuntu, write code in ruby and java in sublime text. Your strawman non-argument has no place on HN

Only half his argument is a strawman. He's still correct that zsh is not omnipresent in the way that bash is, and therefore being proficient in bash is still very useful, regardless of the increase in productivity that putting the time into learning zsh would bring.

Both arguments are not sound though, and as a result demonstrably irrelevant. The title of the thread and the argument in the GP is based on features present in ZSH but not Bash and the benefits there of.

The OP's first argument is: for all operating systems Bash exists. Which, while also untrue is and unrelated to whether ZSH has features or improvements that Bash does not. OP's second argument is: all ZSH users also program in D...., which I won't even bother with.

For what it is worth, I use both Bash and ZSH. Their usage and knowledge there of is not mutually exclusive. The only issue I've encountered with using ZSH is that most build scripts expect to be ran from Bash and will run into issues when that is not the case sometimes, so I open Bash before running the command if I happen to be in ZSH at the time.

If I based my tool choices on popularity instead of their appropriateness for the problem domain my work flow would look much different as well.

Re: How zsh is more useful than bash

#144

Earlier quoted context omitted.

lolwut

Bash is the gnu shell which is a superset not posix which is basic no frills mixture of minimal ksh and bourne syntax. BSD has the almquist shell as it's /bin/sh and tcsh as it's /bin/csh. Various commercial vendors licensed the korn shell from bell labs. The korn shell is public domain and open for 13 years now. The default sh on most UNIX boxes are either ash or a hard link to ksh which emulates the POSIX definitio…

(about Debian use of dash) > I believe they removed it ...

No, /bin/sh still points to dash in the latest and just released Debian stable (Wheezy). It seems to me that this transition was already completed in Sequeeze but I haven't checked.

Re: How zsh is more useful than bash

#145
I'm really glad I switched from bash to zsh a few years ago. zsh is, IMHO, a tiny bit better than bash in many areas. Because I use it all day every day, these little bits better add up to a lot of benefit.

Re: How zsh is more useful than bash

#146
post #95
post #85

Earlier quoted context omitted.

> I don't want to use zsh specific features in my scripts How is this a worry? The topline in your bash script is '#!/bin/bash' Which tells the system 'run this with bash'.

Well I think there are if statements, loop conditions, and wildcard expansion that works in zsh but not in bash. So you could get used to something working in zsh, then you write an sh script with that thing, and then it doesn't work, and you have no idea why. Example, I _think_ / (recursive globbing) works by default in zsh but not in bash. If you have / in a bash script without setting the right options then your s…

When you insert this in the first line of your script

    #!/bin/bash
The specified program is run. From that point on, the bits you're executing in that script are 'bash' no matter what the shell you called it from is.

I've been running zsh on my local system, and happily writing [bash, csh, perl, ruby] using this trick.

Re: How zsh is more useful than bash

#147
post #86

Earlier quoted context omitted.

I don't know what those are, but why not start them with a bash script, that you launch from zsh?

They're designed to mess around with your shell variables and environment to virtualize an environment for ruby or python. Unfortunately, they're not totally compatible with my customized zsh setup, and I don't have the time to rebuild and test a zshrc from scratch. Launching bash with them would be moot since I'd just have to spend my time in bash anyways, then.

Ah! Thanks.

Re: How zsh is more useful than bash

#148
post #115
post #61

My personal favorite zsh specific feature is the REPORTTIME environment variable. When set to a nonzero number it'll automatically print a summary after a long running command. My own http://imgur.com/6LCS1cj

Hmm doesn't work for me, is it an option you need to turn on?

As randuser points out it's an environment variable. There's another one called TIMEFMT which lets you format the output.

Some examples: https://github.com/search?q=TIMEFMT+extension%3Azshrc&ty...

Re: How zsh is more useful than bash

#149
post #114

Earlier quoted context omitted.

> Yes. Not only that but it has something even cooler: ESC + Q ESC+. does not work for me with zsh. zsh 4.3.11 (i386-apple-darwin12.0) Maybe it's the version. ESC+Q also doesn't clear the line. At the same time, the OP links slide deck fails for me at the cd /u/lo/b part. It simply doesn't work.

You probably didn't turn it on when you ran the config wizard thingy.

What config wizard thingy?

I figured this was a default setting.

Re: How zsh is more useful than bash

#150
post #38

I see your zsh and I raise you fish: http://ridiculousfish.com/shell/ Try it. It's better.

I do love the tagline "_Finally, a command line shell for the 90s_". I was happy enough sticking to bash as it's the default shell everywhere, but since someone switched me to Zsh (using oh-my-zsh) I probably rely on the features too much to ever go back. I also hear https://github.com/sorin-ionescu/prezto is a nicer, cleaner fork of oh-my-zsh but I haven't so found the overwhelming desire to go through the switching…

The entire site seems to have that tagline through it as a running joke. I also thoroughly enjoy it.

"Watch out, Netscape Navigator 4.0!" and so on.

Post reply on HN