unix系统管理员工具包: 充分利用 zsh

豆豆网   技术应用频道   2007年05月11日    社区交流

本文详细介绍unix系统管理员工具包: 充分利用 zsh

  清单 22. 在 zsh 中创建复杂结构zsh$ sort <(egrep -v '^#' <(paste -d: <(cut -d: -f5 /etc/passwd) <(cut -d: -f1
/etc/passwd) ) )
:# mode. At other times this information is handled by one or more of
Amavisd User:amavisd
Apple Events User:eppc
Application Owner:appowner
Application Server:appserver
...
Xgrid Agent:xgridagent
Xgrid Controller:xgridcontroller
sshd Privilege separation:sshd

  通过按清单 23 所示来查看每个元素,您可以简化清单 22。

  清单 23. 简化的过程-  <(cut -d: -f1 /etc/passwd) - Get the first field
-  <(cut -d: -f5 /etc/passwd) - Get the fifth field
-  <(paste -d: <(f5) <(f1) ) - Recombine them in a different order
-  <(egrep -v '^#' <(paste...) - Remove the comments
-  sort <(egrep ...) - Sort the standard input

  文件和命令完成

  在某些 Shell (包括 zsh)中,您可以通过按 TAB 键来完成文件或命令。让我们使用当前目录作为示例(请参见清单 24)。

  清单 24. 当前目录清单zsh$ ls
barney     betty.c     fred      fred.o
barney.c    betty.h     fred.c     wilma.c
barney.o    fileone     fred.h

  使用完成功能,您可以输入文件名的开头:zsh$ cd bar。然后按 TAB 键并获得完整或部分完成: zsh$ cd barney.

  第二次按 TAB,您将看到可用文件列表(请参见清单 25)。

作者:Martin C Brown    责编:豆豆技术应用

正在加载评论...