mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-04-27 14:51:14 -03:00
Variables as commands are in fact supported, eval docs should not claim otherwise. (#5819)
Provide an example that somewhat justifies eval's existence in light of this change. Also correct similar misinformation found in a comment.
This commit is contained in:
committed by
Fabian Homborg
parent
22ce8c23c6
commit
38cadc9d4f
@@ -15,16 +15,17 @@ Description
|
||||
|
||||
If your command does not need access to stdin, consider using ``source`` instead.
|
||||
|
||||
If no piping or other compound shell constructs are required, variable-expansion-as-command, as in ``set cmd ls; $cmd``, is also an option.
|
||||
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
The following code will call the ls command. Note that ``fish`` does not support the use of shell variables as direct commands; ``eval`` can be used to work around this.
|
||||
|
||||
|
||||
The following code will call the ls command and truncate each filename to the first 12 characters.
|
||||
|
||||
::
|
||||
|
||||
set cmd ls
|
||||
set cmd ls \| cut -c 1-12
|
||||
eval $cmd
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user