文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>eval命令的作用

eval命令的作用

时间:2008-03-03  来源:ller

                                                                                   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

<<Bash Quick Reference>>
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载