EVAL(1P)
๐ EVAL(1P) โ the POSIX Programmer's Manual page, but make it cute โจ
okay bestie, real talk: this is the EVAL(1P) page from the POSIX Programmer's Manual. That's the whole header, we're moving on ๐
๐ PROLOG ๐
so like, this manual page is part of the POSIX Programmer's Manual. but heads up: the Linux implementation of this interface may differ โ so if you're on Linux, go read the corresponding Linux manual page for the actual tea โ. or... the interface might just not be implemented on Linux at all. rip ๐
๐ธ NAME ๐ธ
eval โ construct command by concatenating arguments
like. it builds a whole command out of your lil argument pieces. that's the job. that's the gig. ๐
โจ SYNOPSIS โจ
eval [argument...]
๐ DESCRIPTION ๐
okay so the eval utility shall construct a command by concatenating arguments together, separating each one with a <space> character. then โ and this is the main character moment โ the constructed command shall be read and executed by the shell. ๐ฆ
it's giving "build a command, then immediately run it." no cap.
๐ฅ OPTIONS ๐ฅ
None.
literally none. not a single flag. we love a low-maintenance icon ๐
๐ OPERANDS ๐
See the DESCRIPTION. (they're the arguments, bestie, they're the whole point)
๐ STDIN ๐
Not used. it doesn't want your input, it's busy โ
๐ง INPUT FILES ๐ง
None.
โญ ENVIRONMENT VARIABLES โญ
None. no env vars needed, she's self-sufficient ๐
๐ซ ASYNCHRONOUS EVENTS ๐ซ
Default.
๐ซถ STDOUT ๐ซถ
Not used. nothing gets printed by eval itself, it just does things.
๐ STDERR ๐
The standard error shall be used only for diagnostic messages. that's it. only for diagnostics. don't expect small talk.
๐ OUTPUT FILES ๐
None.
๐ธ EXTENDED DESCRIPTION ๐ธ
None. there is no extended description. this section is just standing there. respectfully. ๐
๐ EXIT STATUS ๐
okay this part actually matters, listen up:
- If there are no arguments, or only null arguments,
evalshall return a zero exit status ๐ - Otherwise, it shall return the exit status of the command defined by the string of concatenated arguments separated by
<space>characters - or a non-zero exit status if the concatenation could not be parsed as a command and the shell is interactive (and therefore did not abort)
โ ๏ธ note the little "and therefore did not abort" โ if the shell is interactive it doesn't just die, it hands you a non-zero status instead. know the difference, bestie, it's important ๐ญ
๐ฆ CONSEQUENCES OF ERRORS ๐ฆ
Default.
psst โ the following sections are informative. (translation: they're helpful commentary, not requirements โจ)
๐ APPLICATION USAGE ๐
okay so here's the situation: eval is not required to recognize the "--" end of options delimiter. so in cases where the argument(s) to eval might begin with '-', it is recommended that the first argument is prefixed by a string that will not alter the commands to be executed โ such as a <space> character:
eval " $commands"
or:
eval " $(some_command)"
see what she did there? a lil sneaky space at the front, and suddenly your args can't get mistaken for options. iconic behavior. ๐
๐ EXAMPLES ๐
here's the whole vibe, verbatim:
foo=10 x=foo
y='$'$x
echo $y
$foo
eval y='$'$x
echo $y
10
watch the eval line do its lil magic and turn $y into an actual 10. ate. ๐ฅ
๐ง RATIONALE ๐ง
This standard allows, but does not require, eval to recognize "--".
and yes, that means applications cannot use "--" to protect against options supported as an extension (or errors reported for unsupported options). BUT โ and this is the slay part โ the nature of the eval utility is such that other means can be used to provide this protection (see APPLICATION USAGE above ๐).
๐ฎ FUTURE DIRECTIONS ๐ฎ
None.
๐ SEE ALSO ๐
- Section 2.14, Special Built-In Utilities
๐ COPYRIGHT ๐
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
and that's the whole page, bestie ๐ซถ โ brought to you by IEEE/The Open Group, dated 2017, for EVAL(1P). go forth and concatenate responsibly. periodt. ๐
โจ
๐ฆ where this page comes from
- alpine 3.22: man-pages-posix 2017a-r0 ยท custom
- alpine 3.23: man-pages-posix 2017a-r0 ยท custom
- alpine 3.24: man-pages-posix 2017a-r0 ยท custom
- arch rolling: man-pages 6.19-1
- arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages-posix 2017a
- opensuse-leap 16.0: man-pages-posix 2017a-160000.4.1 ยท SUSE-IEEE
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms