Chinaunix首页 | 论坛 | 博客
  • 博客访问: 101067
  • 博文数量: 6
  • 博客积分: 930
  • 博客等级: 准尉
  • 技术积分: 245
  • 用 户 组: 普通用户
  • 注册时间: 2006-07-29 14:07
文章分类

全部博文(6)

文章存档

2011年(1)

2008年(5)

我的朋友

分类:

2008-03-03 17:12:28

                                                                                   eval
eval args
Typically, eval is used in shell scripts, and args is a line of code that contains
shell variables. eval forces variable expansion to happen first and then runs
the resulting command. This “double-scanning” is useful any time shell vari-
ables contain input/output redirection symbols, aliases, or other shell vari-
ables. (For example, redirection normally happens before variable expansion,
so a variable containing redirection symbols must be expanded first using
eval; otherwise, the redirection symbols remain uninterpreted.)
Example
This fragment of a shell script shows how eval constructs a command that is
interpreted in the right order:
     for option
     do
         case "$option" inDefine where output goes
         save) out=’ > $newfile’ ;;
         show) out=’ | more’ ;;
         esac
     done
     eval sort $file $out

<>

阅读(1916) | 评论(0) | 转发(0) |
0

上一篇:没有了

下一篇:使用wget下载整个网站 zz

给主人留下些什么吧!~~