Linked by Thom Holwerda on Tue 26th Dec 2006 15:43 UTC, submitted by bluevoodoo
General Development Examine key parts of the Z shell (zsh) and how to use its features to ease your UNIX system administration tasks. Z shell is a popular alternative to the original Bourne and Korn shells. It provides an impressive range of additional functionality, including improvements for completing different commands, files, and paths automatically, and for binding keys to functions and operations.
Thread beginning with comment 196437
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE: Bash - almost like ZSH
by sukru on Wed 27th Dec 2006 03:55 UTC in reply to "Bash - almost like ZSH"
sukru
Member since:
2006-11-19

The same works for bash shell too. It has a configurable completion support and if you install a package like bash-completion you'll have options for many programs ready.

e.g:

# scp -[TAB]
# scp -r se[TAB]
# scp -r server:/e[TAB]
# scp -r server:/etc/hos[TAB]
# scp -r server:/etc/hosts /etc

And some other features (like process substitution, and few of the filename matching rules) are also available.

I guess they're probably comparing zsh to original bsh, not currently available bash. (Yet it does not make zsh less interesting, probably bash has inspired those feature looking at zsh).

Reply Parent Score: 1

RE[2]: Bash - almost like ZSH
by vermaden on Wed 27th Dec 2006 15:53 in reply to "RE: Bash - almost like ZSH"
vermaden Member since:
2006-11-18

does BASH also can TAB complete inside names like that:

% ls
misc/ resolution scripts/ tmp/
% vi sol[TAB]

Completes to:
% vi resolution

Reply Parent Score: 1

RE[3]: Bash - almost like ZSH
by libray on Wed 27th Dec 2006 19:05 in reply to "RE[2]: Bash - almost like ZSH"
libray Member since:
2005-08-27

Not only do I have zsh completing within names, it also corrects capitalization

% ls -1 *[Dd]ev*
Edge Device Summary.xls
devcom

% soffice devi[TAB]

Competes to the file I want:
"Edge Device Summary.xls"

If I had left it at "dev[TAB]" devcom would have been chosen since it actually matches my case


looping
Another thing I find helpful in interactive use is the use of ellipses:
for i in {1..100000}; do rm file${i}; done

padding: files rigidly named file###
for i in {001..300}; do rm file${i}; done

Want to repeat a process many times?
repeat 1000 echo hello

tab complete ssh
add the following to your zshrc, and you can tab complete the hosts found in ssh's known_hosts. If you have not done so already, you may have to run compinstall

compinit
hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[0-9]*}%% *}%%,*} )
zstyle ':completion:*:hosts' hosts $hosts

Reply Parent Score: 2