Live data from Hacker News

Zsh is your friend.

mikegrouchy.com

41–50 of 117 posts

Re: Zsh is your friend.

#41

- I'm using bash on Ubuntu. When I type "kill " I get a list of process numbers, not the list of files in my current directory as you imply. - shared history sounds like a bug, not a feature. I have long lived terminals open, each dedicated to a specific purpose. Shared history would intermingle them. - typing `gut` in bash gives me: No command 'gut' found, did you mean: Command 'cut' from package 'coreutils' (main)…

Fwiw on #3, it's not the same at all.

1. Your feature comes from Ubuntu, not bash

2. More importantly, in ZSH if the correction is accepted by the user the command gets executed (with the fix) without any manual redoing. The correction can even be made permanent for frequent typos.

(and while I like ZSH a lot, shared history does tend to be a pain in the ass for me)

Re: Zsh is your friend.

#42
post #38

While from what I have read about it zsh is a nice shell, it doesn't deal with what I find to be the biggest problem with bash, sh, and just about every shell that isn't fish: the horribly ugly and inconsistent syntax. And I think it's rather sad that on what is supposedly the most advanced shell of our generation, you still have to deal with a thousand ridiculous redirections and quoting styles, different delimiter…

Try Plan 9's "rc". It has a more C-like syntax, so you write things like "for (i in `{seq 1 100}) { echo $i }"; I really enjoy writing in rc.

How is that better than

bash or zsh:

    for i in `seq 1 100`; do echo $i; done
zsh:

    for i in `seq 1 100`; echo $i

Re: Zsh is your friend.

#43

The supremacy of bash over zsh &c. seems to be an excellent case study in the "Worse is Better" hypothesis. http://www.jwz.org/doc/worse-is-better.html

Not really, you're not seeing bash have many more features because its simpler on the inside at the cost of sometimes breaking. Rather, it seems an example of " the most dangerous enemy of a better solution is an existing codebase that is just good enough"

Re: Zsh is your friend.

#44

Earlier quoted context omitted.

This is indeed a lovely feature I couldn't live without. In bash, you can get it by adding the following to your .inputrc (at least on mac terminal) "\e[B": history-search-forward "\e[A": history-search-backward

I believe in bash and zsh the default is ^R and ^S

except a huge number of terminal emulators still reserve ^S/^Q for XON/XOFF software flow-control[1].

    stty -ixon
lives in my init scripts for that reason.

[1] https://en.wikipedia.org/wiki/Software_flow_control

Re: Zsh is your friend.

#45

I like zsh. Probably my favorite feature is that it will autocomplete paths/filenames in an scp command on the remote end if authentication is done with keys. Also you can do stuff like /u/l/b and hit TAB.

Probably my favorite feature is that it will autocomplete paths/filenames in an scp command on the remote end if authentication is done with keys.

This is possible in Bash too with bash-completion.

Re: Zsh is your friend.

#46

Earlier quoted context omitted.

Shared history can be either a burden or a godsend, I like it but I usually just end up using whatever basic bash shell I'm on without a custom config as most of the things I do are remote. The zsh autocorrect works much differently than what you have given. You have shown a feature of ubuntu (and probably debian) that looks for packages matching/close to your given command but what zsh does is give you, depending on…

Zsh has knobs for shared history. You can configure all terminals to have the same history at the same time, but I have it set to add history to the .zsh_history file immediately, but each shell gets it's own history. So ctrl-r in a shell lists commands entered into that shell (or preexisting when it started), and opening a new terminal starts with the shared history from all terminals. This is really the best of bot…

wow - would you know the settings for the whole shared history thing you wrote about. I have mine set up in a less than ideal way and have never been able to google for these settings.

Re: Zsh is your friend.

#47
post #7

Earlier quoted context omitted.

The thing I like about fish is the easy history nav. I type "git" and press Up, and I get to go through my history of anything that started with "git" very quickly. I'll often remember I typed an svn command three weeks ago, but forget the parameters, and I'll have it back within 15 seconds. It's like magic!

This is indeed a lovely feature I couldn't live without. In bash, you can get it by adding the following to your .inputrc (at least on mac terminal) "\e[B": history-search-forward "\e[A": history-search-backward

in zsh you get it by adding

bindkey "^[[A" history-beginning-search-backward

bindkey "^[[B" history-beginning-search-forward

Re: Zsh is your friend.

#48

Earlier quoted context omitted.

Shared history can be either a burden or a godsend, I like it but I usually just end up using whatever basic bash shell I'm on without a custom config as most of the things I do are remote. The zsh autocorrect works much differently than what you have given. You have shown a feature of ubuntu (and probably debian) that looks for packages matching/close to your given command but what zsh does is give you, depending on…

Zsh has knobs for shared history. You can configure all terminals to have the same history at the same time, but I have it set to add history to the .zsh_history file immediately, but each shell gets it's own history. So ctrl-r in a shell lists commands entered into that shell (or preexisting when it started), and opening a new terminal starts with the shared history from all terminals. This is really the best of bot…

im pretty sure bash does shared history if you desire it, the configuration is just not as directly obvious.

I prefer a long histfile (unlimited really, i. think i have it set to a million lines, but im at about 70 000. i even keep it backed up regularly because its fairly easy to trash the histfile if you are opening subshells and do the wrongthing. timestamped, too, which i find really handy.

that said, i do use and like zsh on my primary workstation, love it.. but i dont bother priming every other remote box with it, my bash config is simple and tweaked up just rightfor remote servers, and bash is there by default (dealing with older systems, etc.....i know zsh is installed by default often too)

Re: Zsh is your friend.

#50
post #42
post #38

Earlier quoted context omitted.

Try Plan 9's "rc". It has a more C-like syntax, so you write things like "for (i in `{seq 1 100}) { echo $i }"; I really enjoy writing in rc.

How is that better than bash or zsh: for i in `seq 1 100`; do echo $i; done zsh: for i in `seq 1 100`; echo $i

It's sort of ok when its `do... done`. But what about `if`..`fi` or `case`..`esac`.

+1 for rc.

Post reply on HN