Live data from Hacker News

Zsh is your friend.

mikegrouchy.com

21–30 of 117 posts

Re: Zsh is your friend.

#21
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

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

Re: Zsh is your friend.

#22

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…

I have been using fish for several years now. It's community is a fraction of zsh, bash, and others, and I've tried to go back to them, mostly out of misplaced "everyone else is doing it" mindset

Fish is a great shell. It's a modern shell, that uses colors, UTF, and processing power that didn't exist when the others were designed. I feel the best thing about it is the sane defaults and large number of prebuilt completions. For any other shell, I have to dive into bashrc's and esoteric commands to get what I want. Fish just does what I want. It's made me far more productive, and for that, it gets my best shell award.

Its scripting support is good, very similar to other shells. Yes, the syntax is non-compatible, and not even POSIX. But, it makes more sense. Besides, for anything except the simplest of scripts, I use lua. I doubt you'd want to use bash to do something very complicated.

Some people want their shell scripts to be compatible and do a lot of cool things. I feel that the days of a shell being used for scripting are past. For me, a shell is a way of interacting with the system. Fish does this really well. Scripting is a slight afterthought, as it should be.

Re: Zsh is your friend.

#23
Is anybody else addicted to shell mode within emacs?

I love having the shell as just another buffer right in the editor. Easy history searchability, copy and paste between code and various repls or SQL prompts, and all the other full editor features available at the prompt.

Re: Zsh is your friend.

#24

- 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)…

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 your chosen settings, full autocorrect.

Where you may be able to type gut status and get No command found the setup in zsh would allow either for gut status to be autocorrected to git status or would ask you if you meant git status while waiting for a confirmation.

Re: Zsh is your friend.

#25

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…

I have been using fish for several years now. It's community is a fraction of zsh, bash, and others, and I've tried to go back to them, mostly out of misplaced "everyone else is doing it" mindset Fish is a great shell. It's a modern shell, that uses colors, UTF, and processing power that didn't exist when the others were designed. I feel the best thing about it is the sane defaults and large number of prebuilt comple…

Do you have to do anything weird to Lua to make it work as a system scripting language? Do you just use the built in OS interfaces?

Re: Zsh is your friend.

#26

- 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)…

He also doesn't hit the mark on editing modes. Emacs and Vi keybindings for shells are usually provided by libreadline.

I was really looking for a different shell before. But if those are zsh killler features, it certainly wont be my choice.

Re: Zsh is your friend.

#27
post #18
post #15

Earlier quoted context omitted.

Maybe I lack the proper zen, but I haven't found this to be true at all. Here's a good bash FAQ. It contains questions like "how do I use associative arrays", with answers like "this is a complex question." I don't even have to ask in any half-decent scripting language. http://mywiki.wooledge.org/BashFAQ/

I reccommend ksh over bash. That's all I use these days. It was sh done right, although it does have a bit of history to it for compatibility. To use associative arrays in ksh: typeset -A table column="name" table[$column]="value" echo ${table[$column]} ksh is much more decent than bash, although I reccommend using in an emacs M-x shell buffer for better command line editing. Edit: forgot to dereference column when s…

For reference, to use associative arrays in Bash:

  declare -A table
  column="name"
  table[$column]="value"
Included in recent versions of bash :)

Re: Zsh is your friend.

#28
post #14

Earlier quoted context omitted.

I think your complaining more about shell scripting rather than the terminal use itself.

I think you're underestimating how frequently some folks do things like: for x in 'seq 1 100'; do echo "something with $x"; done (Please forgive lack of backticks on my cellphone keyboard) Or many variations, like every line in a file, or result of a command piped to sed or awk and then processed. Init scripts are about the only shell scripts I write anymore, but I use frequently use it from the commandline, typicall…

Just forget backticks even exist.

I now always use $(cmd) instead of `cmd`. Much easier to read and it fits in better with process substitution <(cmd). More importantly it all nests sanely $(cmd1 $(cmd2)) and works well in quotes "Blah: $(cmd1 $(cmd2))".

Re: Zsh is your friend.

#29
post #26

- 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)…

He also doesn't hit the mark on editing modes. Emacs and Vi keybindings for shells are usually provided by libreadline. I was really looking for a different shell before. But if those are zsh killler features, it certainly wont be my choice.

Zsh use's zle(Z-Shell Line Editor), which is different then libreadline as its part of the shell not a separate library. Zle's behavior is editable through your .zshrc.

Maybe I dumbed the post down too much, was just listing a few features that I use every day that IMO work better then the comparable Bash features.

Re: Zsh is your friend.

#30

- 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)…

In fairness to zsh, "kill " just lists the number rather than giving the names. In zsh or fish, by contrast, you get the process name too.
Post reply on HN