News for hackers. Stuff that matters.
Re:Better bash in 15 minutes by oneandoneis2 on Wednesday April 16, 2014 @04:50AM (#7596730)
A link on HN about improving bash and it wasn't instructions on how to install zsh. I'm pleasantly surprised :)
Re:Better bash in 15 minutes by weaksauce on Wednesday April 16, 2014 @08:25AM (#7597297)
I like bash and all, but a well tuned zsh is amazing. I was hesitant for a while but it really improved my workflow in the shell.
Re:Better bash in 15 minutes by stormbrew on Wednesday April 16, 2014 @10:30PM (#7601741)
The thing about a shell (much like an editor, really) is that if you invest in it too far it becomes much more frustrating than reasonable to go without it. If you tend to shell in to a lot of servers that you lack control over, getting used to zsh niceties just makes the rest of your life that much harder. At least in my experience.
Re:Better bash in 15 minutes by uuid_to_string on Thursday April 17, 2014 @12:18AM (#7601980)
What if you invested in learning a shell that was installed on all servers you lack control over?

What if you invested in learning POSIX sh?

Wouldn't your scripts and one liners written in POSIX sh work in zsh, bash, etc.?

You could be comfortable on any server, no matter what the shell.

Even servers that default to tcsh still have /bin/sh.

Re:Better bash in 15 minutes by stormbrew on Thursday April 17, 2014 @12:33AM (#7602004)
I'm not saying don't do that, and I'm comfortable using and scripting for anything from POSIX sh to zsh, can get by in fish, etc, etc.

But if you're going to dive deep on any of them, bash has a pretty unique and strong argument for being quite likely to be available on most of the machines you work with on a day to day basis.

Re:Better bash in 15 minutes by uuid_to_string on Thursday April 17, 2014 @12:44AM (#7602029)
By "you" do you mean me, personally?

The servers I use do not have bash installed by default.

The only time I use it is when I am forced to by an installation script.

I install bash on an as needed basis, and when I'm done using it, I uninstall it. I just have no need for it otherwise.

What is the shell on Android? Is it bash?

Re:Better bash in 15 minutes by stormbrew on Thursday April 17, 2014 @12:56AM (#7602051)
No, definitely meant it as a general thing. And really, directed towards people working with servers, and not to people working with embedded devices (like Android) where keeping to POSIX (or specifically ash, which is what android and busybox use) is probably a necessity.

Many servers don't have bash installed as part of their base distribution, but if they're going to have another shell already installed it's much more likely to be bash than zsh.

Re:Better bash in 15 minutes by TylerE on Wednesday April 16, 2014 @09:58AM (#7597763)
Yep!

And thanks to oh-my-zsh (https://github.com/robbyrussell/oh-my-zsh) it really requires very little fiddling, maybe 10 minutes worth.

Re:Better bash in 15 minutes by themoonbus on Wednesday April 16, 2014 @10:30AM (#7597984)
I'm a recent zsh + oh-my-zsh convert, and I have a severe case of "why didn't I do this before"s.

Here is a great gallery of oh-my-zsh themes: http://zshthem.es/all/

Re:Better bash in 15 minutes by TylerE on Wednesday April 16, 2014 @10:57AM (#7598157)
Yea, it's pretty awesome.

What's really neat is you can even use it on Windows.

My personal setup is Cygwin Zsh inside Console2 (tabbed cmd.exe shell) proxied via ansicon.exe (makes cmd.exe ansi color escape aware). It's not quite as nice as say Konsole on linux or iTerm2 on a mac, but it's the best I've found for windows.

Setup guide:

Setup console2 like this http://www.hanselman.com/blog/Console2ABetterWindowsCommandP...

This post sets up ansicon: http://www.kevwebdev.com/blog/in-search-of-a-better-windows-...

Re:Better bash in 15 minutes by NateEag on Saturday April 19, 2014 @01:06AM (#7612645)
I'm stuck on Windows at work, and landed on ConEmu as my terminal emulator (running bash, though - I've never made the jump to zsh):

https://code.google.com/p/conemu-maximus5/

I haven't tried Console2, so I can't provide a comparison, but here's Scott Hanselman deciding to switch: http://www.hanselman.com/blog/ConEmuTheWindowsTerminalConsol...

Re:Better bash in 15 minutes by curiousbiped on Wednesday April 16, 2014 @06:44PM (#7600979)
See also antigen(https://github.com/zsh-users/antigen), it works with oh-my-zsh and makes adding extra plugins a lot cleaner.
Re:Better bash in 15 minutes by oneandoneis2 on Wednesday April 16, 2014 @09:53AM (#7597732)
I switched from bash to zsh some times ago, and miss it when it's not there.. but TBH, the only real difference for me is zsh can turn 'cd s/l/f/p[tab]' into 'cd some/long/file/path' - all other features I'm aware of either exist in Bash too, or aren't useful for me.

What are some of the differences that made such a difference for you?

Re:Better bash in 15 minutes by foxhill on Wednesday April 16, 2014 @10:17AM (#7597883)
off the top of my head:

- tab completion on a shit-ton of stuff (configure scripts, makefiles, ssh hosts, aptitude packages, git branches)

- partially entered command? push up to look at similar commands you have previously entered

- immediate propagation of zsh_history to all open shells

you could (correctly) argue that you can do all that in bash. of course, shell scripting is turing complete, so yes, you can. but with zsh, it's already there, and ready.

Re:Better bash in 15 minutes by __david__ on Wednesday April 16, 2014 @12:56PM (#7598915)
Bash has wonderful completion, all the stuff you listed. It's in the "bash-completion" package, and usually just an "apt-get install bash-completion" away.

I use bash's reverse incremental search ("C-r") to do that. Is the zsh that much better than that?

The history sounds neat, except that I tend to segregate my terminal tabs to specific tasks/projects so I'm not very likely to want a command from one tab in another. Also I always set my bash history file to /dev/null so I don't have to worry about leaving sensitive data lying around, which means I new tabs are always a clean slate.

Re:Better bash in 15 minutes by foxhill on Wednesday April 16, 2014 @03:34PM (#7599998)
> Bash has wonderful completion, all the stuff you listed. It's in the "bash-completion" package, and usually just an "apt-get install bash-completion" away.

i don't doubt that at all - but it's hardly default bash, and i frequently don't have root on the systems i use (whereas zsh is usually there)

> I use bash's reverse incremental search ("C-r") to do that. Is the zsh that much better than that?

hands down yes. nobody had to explain how "up-complete" (i don't know what's it's called, but i'm calling it that because that's what it does) works to me. simple and intuitive!

> Also I always set my bash history file to /dev/null

fair enough - different people have different uses for things, i thoroughly recommend you try zsh though, because, why not! have a poke around the excellent oh-my-zsh as well, try out some themes.

i thought i had a good work flow with bash, and that there was really any room for improvement. after a few hours of zsh on my laptop, it was my shell everywhere :)

Re:Better bash in 15 minutes by wtetzner on Wednesday April 16, 2014 @02:48PM (#7599708)
Also, M-q to stash the current command, run another command, and have the first command pasted back to the prompt, with point in the right location.
Re:Better bash in 15 minutes by Nick_C on Friday April 18, 2014 @10:32PM (#7612361)
That's neat, you could almost convert me.

For Bash, M-# (alt-shift-3) puts a comment token '#' at the start of the current line and begins a new empty line. Handy if you are 150 characters deep in a command and realise you need to do something else for a moment (i.e. momentarily in the correct sense). You can store your 150 char command and come back to it, it is in the history and can be retrieved with a couple of Up-arrows.

Re:Better bash in 15 minutes by valarauca1 on Wednesday April 16, 2014 @12:51PM (#7598882)
tab completion is a default feature of GNU BASH
Re:Better bash in 15 minutes by weaksauce on Wednesday April 16, 2014 @02:42PM (#7599643)
it tab completes more than bash does. switches, parameters, servers defined in your .ssh/config file etc. it's really impressive. coupled with the jump/mark script[1] it's amazing.

mark . marks the current directory in a folder full of symlinks.

jump <tab> expands to a list of your favorite folders.

super simple and extremely low overhead.

[1] http://jeroenjanssens.com/2013/08/16/quickly-navigate-your-f...

Re:Better bash in 15 minutes by dllthomas on Wednesday April 16, 2014 @05:17PM (#7600584)
Well, bash tab-completes with arbitrary complexity, seeing as it can be set to call functions... I assume the same is true of zsh, so the real question has to be adjusted for particular setup. There are a number of interesting questions of that form. Off the top of my head: The minimal setup I get from simplest packages in distro X at time Y. The maximal setup I can extract from distro X at time Y. The typical install I am likely to sit down at if it is not my own. The setup I am likely to evolve to after working with the system for it for time T...
Re:Better bash in 15 minutes by smorrow on Wednesday April 16, 2014 @11:10AM (#7598237)

  cd s*/l*/f*/p*
Re:Better bash in 15 minutes by sliverstorm on Wednesday April 16, 2014 @12:26PM (#7598717)
I keep switching back and forth between the two. The latest versions of bash have recovered a lot of ground, and zsh (in my experience) has a tendency to get really slow. Maybe it's the command completion here, or the history search there, but it just tries to be too sophisticated for my purposes (huge cluster environment with countless executables in my PATH, which by the way is constantly changing)