1EVAL(1P)                   POSIX Programmer's Manual                  EVAL(1P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       eval — construct command by concatenating arguments
13

SYNOPSIS

15       eval [argument...]
16

DESCRIPTION

18       The eval utility shall construct a command by  concatenating  arguments
19       together,  separating  each  with a <space> character.  The constructed
20       command shall be read and executed by the shell.
21

OPTIONS

23       None.
24

OPERANDS

26       See the DESCRIPTION.
27

STDIN

29       Not used.
30

INPUT FILES

32       None.
33

ENVIRONMENT VARIABLES

35       None.
36

ASYNCHRONOUS EVENTS

38       Default.
39

STDOUT

41       Not used.
42

STDERR

44       The standard error shall be used only for diagnostic messages.
45

OUTPUT FILES

47       None.
48

EXTENDED DESCRIPTION

50       None.
51

EXIT STATUS

53       If there are no arguments, or only null arguments, eval shall return  a
54       zero  exit  status;  otherwise,  it shall return the exit status of the
55       command defined by the string of concatenated  arguments  separated  by
56       <space>  characters,  or  a  non-zero  exit status if the concatenation
57       could not be parsed as a command and  the  shell  is  interactive  (and
58       therefore did not abort).
59

CONSEQUENCES OF ERRORS

61       Default.
62
63       The following sections are informative.
64

APPLICATION USAGE

66       Since  eval is not required to recognize the "--" end of options delim‐
67       iter, in cases where the argument(s) to eval might begin with '-' it is
68       recommended  that  the first argument is prefixed by a string that will
69       not alter the commands to be executed, such as a <space> character:
70
71
72           eval " $commands"
73
74       or:
75
76
77           eval " $(some_command)"
78

EXAMPLES

80       foo=10 x=foo
81       y='$'$x
82       echo $y
83       $foo
84       eval y='$'$x
85       echo $y
86       10
87

RATIONALE

89       This standard allows, but does not require,  eval  to  recognize  "--".
90       Although  this  means  applications  cannot use "--" to protect against
91       options supported as an extension (or errors reported  for  unsupported
92       options),  the  nature of the eval utility is such that other means can
93       be used to provide this protection (see APPLICATION USAGE above).
94

FUTURE DIRECTIONS

96       None.
97

SEE ALSO

99       Section 2.14, Special Built-In Utilities
100
102       Portions of this text are reprinted and reproduced in  electronic  form
103       from  IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
104       table Operating System Interface (POSIX), The Open Group Base  Specifi‐
105       cations  Issue  7, 2018 Edition, Copyright (C) 2018 by the Institute of
106       Electrical and Electronics Engineers, Inc and The Open Group.   In  the
107       event of any discrepancy between this version and the original IEEE and
108       The Open Group Standard, the original IEEE and The Open Group  Standard
109       is  the  referee document. The original Standard can be obtained online
110       at http://www.opengroup.org/unix/online.html .
111
112       Any typographical or formatting errors that appear  in  this  page  are
113       most likely to have been introduced during the conversion of the source
114       files to man page format. To report such errors,  see  https://www.ker
115       nel.org/doc/man-pages/reporting_bugs.html .
116
117
118
119IEEE/The Open Group                  2017                             EVAL(1P)
Impressum