28 February 2009

Link to a shell escaping tutorial

A nearby LUG member just posted to the LUG's mailing list an explanation of how bash expands variables containing special characters and how various utilities interpret them. Give it a read. How to handle newlines was something I never thought about.


massysett said...

zsh fares much better in these situations. See e.g.


Another reason I stick with zsh for interactive use.

massysett said...

Whoops, url got mangled in last comment. Blogger wants to wrap it; oh well.


The designer of the fish shell also paid attention to these issues.


I'm pretty hard on bash but I honestly see no reason to use it. Unlike straight sh, it's not portable; unlike fish, it carries the huge design warts of the past; unlike zsh, it's not as powerful for interactive use; unlike ksh, it's slow. It has the worst of all worlds and the biggest reason it's still in widespread use is just inertia--there was a time when it was the only free shell, but times have changed.