|
|
1.1 root 1:
2:
3: eval Command eval
4:
5:
6:
7:
8: Evaluate arguments
9:
10: eevvaall [_t_o_k_e_n ...]
11:
12: The shell sh normally evaluates each token of an input line
13: before executing it. During evaluation, the shell performs
14: parameter, command, and file name pattern substitution, as
15: described in sh. The shell does not interpret special characters
16: after performing substitution.
17:
18: eval is useful when an additional level of evaluation is re-
19: quired. eval evaluates its arguments and treats the result as
20: shell input. For example,
21:
22:
23: A='>file'
24: echo a b c $A
25:
26:
27: simply prints the output
28:
29:
30: a b c >file
31:
32:
33: because `>' has no special meaning after substitution, but
34:
35:
36: A='>file'
37: eval echo a b c $A
38:
39:
40: redirects the output
41:
42:
43: a b c
44:
45:
46: to file. Similarly,
47:
48:
49: A='$B'
50: B='string'
51: echo $A
52: eval echo $A
53:
54:
55: prints
56:
57:
58:
59:
60:
61:
62:
63:
64: COHERENT Lexicon Page 1
65:
66:
67:
68:
69: eval Command eval
70:
71:
72:
73: $B
74: string
75:
76:
77: In the first echo the shell performs substitution only once.
78:
79: The shell executes eval directly.
80:
81: ***** See Also *****
82:
83: commands, sh
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130: COHERENT Lexicon Page 2
131:
132:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.