News for hackers. Stuff that matters.
Re:Zsh-lovers – tips, tricks and examples for the Z shell by phreeza on Saturday March 30, 2013 @12:34PM (#5465872)
This list is great (and old), but what I would really like is a more concise list of stuff zsh can do that bash can't, and that has been vetted by people who know bash well. (like one thing that comes to mind is recursive globbing with two astersisks, but to be honest I have no clue if maybe bash can do that too by now).

The reason why I want such a list is I usually point people to zsh-lovers list who ask me why I use zsh, but something more to the point would be great, and probably more convincing.

Re:Zsh-lovers – tips, tricks and examples for the Z shell by tmhedberg on Saturday March 30, 2013 @03:00PM (#5466302)
> (like one thing that comes to mind is recursive globbing with two astersisks, but to be honest I have no clue if maybe bash can do that too by now)

It can, if you set the `globstar` option:

    $ shopt -s globstar
    $ echo **/*.txt
    a/a2/baz.txt a/bar.txt a/foo.txt b/bar.txt b/foo.txt
Re:Zsh-lovers – tips, tricks and examples for the Z shell by reyan on Saturday March 30, 2013 @03:33PM (#5466393)
Re:Zsh-lovers – tips, tricks and examples for the Z shell by q_revert on Saturday March 30, 2013 @03:51PM (#5466443)
another nice one which i get a lot of use out've.. (again, no idea if bash can do this too)

   $ setopt brace_ccl #put this in your ~/.zshrc

   $ echo {1-3}.pdf {a-d}.pdf
   1.pdf 2.pdf 3.pdf a.pdf b.pdf c.pdf d.pdf
Re:Zsh-lovers – tips, tricks and examples for the Z shell by jvehent on Saturday March 30, 2013 @04:00PM (#5466476)
Bash can do that easily, the syntax is just a bit different

    $ echo {1..3}.pdf {a..d}.pdf
    1.pdf 2.pdf 3.pdf a.pdf b.pdf c.pdf d.pdf
Re:Zsh-lovers – tips, tricks and examples for the Z shell by dima55 on Saturday March 30, 2013 @04:44PM (#5466619)
The parent was wrong, and bash can't do the thing he MEANT. The above aren't globs, they just generates strings. None of those files need to exist. In zsh you can use

    <7-10>.txt
to match 7.txt, 8.txt, 9.txt and 10.txt. Zero-padding is loose. 07.txt and 08.txt match also, for instance. The bash {..} syntax just doesn't handle this variable 0-padding case, which is extremely common when looking at a directory full of photos, for instance.
Re:Zsh-lovers – tips, tricks and examples for the Z shell by gnosis on Saturday March 30, 2013 @01:40PM (#5466069)
This[1] talk is kind of old, and I'm sure bash now has some of the features only zsh had at the time, but it should give you a feel for how zsh differs from and improves on bash.

Another thing I suggest doing is joining #zsh on freenode, and asking your questions there.

Yet another thing you could do is skim through the zsh user's guide[2], which is also kind of old, but is pretty comprehensive (for the time), and will give you more of a feel for what zsh can do. zsh's man pages are also very comprehensive (and huge), and might be worth a peek.

[1] - http://ft.bewatermyfriend.org/comp/zshtalk.html

[2] - http://zsh.sourceforge.net/Guide/zshguide.html

Re:Zsh-lovers – tips, tricks and examples for the Z shell by recuter on Saturday March 30, 2013 @12:43PM (#5465908)
Also it is worth nothing that Bash does get updates and newer versions get some features that zsh has. So if it made sense to switch in the past perhaps it no longer does. 'etc.

Sometimes I wish there wasn't so much duplication of effort in this world..

Re:Zsh-lovers – tips, tricks and examples for the Z shell by pyre on Saturday March 30, 2013 @02:05PM (#5466152)
On Ubuntu at least, when you install virtualenvwrapper from apt, it drops the file you need to source into the bash completion directory[1], presumably so that it will be automatically loaded when bash launches. As a zsh user, this annoys the hell out of me. If they dropped it in $PATH, then you could just do:

  source virtualenvwrapper
and be done with it. I guess that's a (small) hit against zsh though. :P

[1] /etc/bash_completion.d/virtualenvwrapper

Re:Zsh-lovers – tips, tricks and examples for the Z shell by elithrar on Saturday March 30, 2013 @05:28PM (#5466717)
There's a oh-my-zsh plugin for virtualenvwrapper that offers some helper functions; very useful.
Re:Zsh-lovers – tips, tricks and examples for the Z shell by mrud on Saturday March 30, 2013 @05:21PM (#5466707)
I created some screenshots [1] showing some things, menu based tab completion, global aliases, included vcs prompt support for git, svn, hg, bzr, cvs etc.

There are plenty more features like for example hashed directories, e.g. shortcuts to a directory:

    hash -d log=/var/log
    cd ~log  # PWD is /var/log
and plenty more.

[1] http://imgur.com/a/gqpsF

Re:Zsh-lovers – tips, tricks and examples for the Z shell by mikagrml on Sunday March 31, 2013 @05:32AM (#5468203)
Maintainer of zsh-lovers here.

The project is quite old already and could need some love. If someone wants to contribute, it's available on GitHub: https://github.com/grml/zsh-lovers

A more recent project similar to zsh-lovers is http://grml.org/zsh-pony/ - this are the notes from a talk I gave at DebConf 2011 and also covers some nice features of Zsh. Should be easier to go through that than through zsh-lovers if you're interested in an introduction of nifty features.

I guess the reason why no up2date list of "what Zsh can do but Bash can't" exists is that most people who explore Zsh never really look back to Bash once they went the Zsh route. Bash v4 got some features from Zsh but there are so many small things that Zsh still provides that once you get used to them you never want to go back. :)

Re:Zsh-lovers – tips, tricks and examples for the Z shell by kbouw on Saturday March 30, 2013 @12:39PM (#5465893)
Same, i'm rather new to using zsh but it would help greatly if there was a comparative list between bash and zsh defining the differences. It was suggested to me by a couple of friends but at this stage, i'm not clear on why I would benefit from using zsh over bash.
Re:Zsh-lovers – tips, tricks and examples for the Z shell by pyre on Saturday March 30, 2013 @02:07PM (#5466162)
I don't know if bash has this, but some commands have tab-completion on the arguments, with a listing for multiple hits:

  $ tar --c<tab>
  --check-device                   -- check device numbers when creating incremental                                                              
  --check-links                    -- print a message if not all links are dumped                                                                 
  --checkpoint                     -- display progress messages every NUMBERth record                                                             
  --checkpoint-action              -- execute ACTION on each checkpoint                                                                           
  --compare                        -- find differences between archive and file system                                                            
  --compress                       -- filter the archive through compress                                                                         
  --concatenate        --catenate  -- append tar files to an archive                                                                              
  --confirmation                   -- ask for confirmation for every action                                                                       
  --create                         -- create a new archive
Re:Zsh-lovers – tips, tricks and examples for the Z shell by entropie on Saturday March 30, 2013 @02:46PM (#5466277)
Bash can do this too.
Re:Zsh-lovers – tips, tricks and examples for the Z shell by pyre on Sunday March 31, 2013 @12:21AM (#5467693)
I know that bash can do completion. I just wasn't aware if bash dot '--c<tab>' completion, or if it listed possible completions for that.
Re:Zsh-lovers – tips, tricks and examples for the Z shell by tomsthumb on Saturday March 30, 2013 @03:42PM (#5466414)
How? That would be handy...
Re:Zsh-lovers – tips, tricks and examples for the Z shell by thebillywayne on Saturday March 30, 2013 @04:21PM (#5466548)
Install the bash-completion package. [1] You'll then find a directory /etc/bash_completion.d/ which has all of the commands the package knows about. The number of commands can be extended.

[1] http://bash-completion.alioth.debian.org/

Re:Zsh-lovers – tips, tricks and examples for the Z shell by e12e on Saturday March 30, 2013 @04:21PM (#5466550)
On a Debian derivate distribution, do:

  sudo aptitude install bash-completion #or apt-get install...
  #Then in your .bashrc do something like:
  # enable programmable completion features (you don't need to enable
  # this, if it's already enabled in /etc/bash.bashrc).
  if [ -f /etc/bash_completion ]
  then
      . /etc/bash_completion
  fi
The latter (or equivalent) is already in /etc/skel/.bashrc on Debian at least (provided by the bash package), so users created with eg. adduser already have this in their .bashrc. IIRC it may be commented out in Debian stable - I currently run testing, and /etc/skel/.bashrc there contains:

  # enable programmable completion features (you don't need to enable
  # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
  # sources /etc/bash.bashrc).
  if ! shopt -oq posix; then
    if [ -f /usr/share/bash-completion/bash_completion ];   then
      . /usr/share/bash-completion/bash_completion
    elif [ -f /etc/bash_completion ]; then
      . /etc/bash_completion
    fi
  fi

edit: missing words
Re:Zsh-lovers – tips, tricks and examples for the Z shell by sliverstorm on Saturday March 30, 2013 @01:41PM (#5466075)
There's just a lot of nifty little features. Two of the most important for me have been shared history between my 20+ terminal sessions, and properly handling wrapping of the command prompt. I am sure bash can wrap properly, but I couldn't figure out why it wasn't and zsh never gave me that problem!