File: eval.rst

package info (click to toggle)
fish 4.2.1-3.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 35,980 kB
  • sloc: python: 6,972; javascript: 1,407; sh: 1,009; xml: 411; ansic: 230; objc: 78; makefile: 20
file content (29 lines) | stat: -rw-r--r-- 738 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
eval - evaluate the specified commands
======================================

Synopsis
--------

.. synopsis::

    eval [COMMANDS ...]

Description
-----------
**eval** evaluates the specified parameters as a command.
If more than one parameter is specified, all parameters will be joined using a space character as a separator.

If the command does not need access to stdin, consider using :doc:`source <source>` instead.

If no piping or other compound shell constructs are required, variable-expansion-as-command, as in  ``set cmd ls -la; $cmd``, is also an option.

Example
-------

The following code will call the ls command and truncate each filename to the first 12 characters.

::

    set cmd ls \| cut -c 1-12
    eval $cmd