Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1723815
  • 博文数量: 293
  • 博客积分: 10574
  • 博客等级: 上将
  • 技术积分: 5085
  • 用 户 组: 普通用户
  • 注册时间: 2006-12-22 17:00
文章分类

全部博文(293)

文章存档

2011年(27)

2010年(84)

2009年(62)

2008年(120)

我的朋友

分类:

2010-11-23 16:49:15

整理了几个:
 
1、
[neo]$ awk 'BEGIN{a=system("test -f /etc/passwdd");if(a) {print "file not exist!";exit}}{print $1}' /etc/passwd
file not exist!
 
2、
[neo]$ awk 'BEGIN{if(system("test -f /etc/passwdd")) {print "file not exist!";exit}}{print $1}' /etc/passwd
file not exist!
 
3、
[neo]$ awk 'BEGIN{if((getline<"/etc/passwdd")==-1) {print "file not exist!";exit}}{print $1}' /etc/passwd
file not exist!
 
4、
[neo]$ awk '{"[ -e /etc/passwdd ]&&echo 1||echo 0"|getline a;if(!a) {print "error";exit}}{print $1}' /etc/passwd
error
阅读(2041) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2010-11-24 13:19:30

很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com