[nycbug-talk] Shell Newbie

Michael Hernandez mhernandez at ocsny.com
Wed Apr 12 10:44:08 EDT 2006


> On Apr 12, 2006, at 9:58 AM, Huy Ton That wrote:
>
>> Hey all, I've always used the bash shell and wanted to get into
>> some shell scripting.  Before I started, I curious to see if anyone
>> had any feedback as far as other shells are out there and just get
>> a feel for the general preference if any exists; speaking purely
>> for flexibility.


I've found that zsh is definitely the best for me, though some might  
say it's bloated (because it is).

Bloated though it may be, there are things you can do with zsh that  
you just can't do with any other.
For example, if you want to remove spaces from filenames, you can  
simply:

         for file in ./*\ *; do mv $file ${file:gs/\ /_/}; done;

since zsh has a builtin sort of "sed" functionality.

Another use of that sed like ability is changing filenames to be all  
lowercase:

         for name in ./*[[:upper:]]*; do mv $name ${name//(#m)[A-Z]/$ 
{(L)MATCH}}; done;

Of course you can get those things done with standard unix shell  
tools, but I find it very convenient to have that sort of thing built  
in to the shell.  I think of it as the ultimate in flexibility. Of  
course you can get spoiled after a while... you will want zsh on  
every machine ;)

Mike



More information about the talk mailing list