lk/basics/eval.md

23 lines
254 B
Markdown
Raw Permalink Normal View History

2024-04-07 09:52:24 +00:00
---
title: "eval"
tags: [ "basics" ]
---
Compose a statement for execution.
```bash
x='echo $y'
echo $x
y=dragon
eval "$x"
```
The results remain in the current shell, unlike sub-shells.
```bash
b=basilisk
sh -c 'echo $b'
eval "g=goblin"
echo $g
```