From e0e403fc96efd3f6d6f259c7ab7fcd4ecdde3ac6 Mon Sep 17 00:00:00 2001 From: Malin Freeborn Date: Sun, 7 Apr 2024 11:52:24 +0200 Subject: [PATCH] write eval --- basics/eval.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 basics/eval.md diff --git a/basics/eval.md b/basics/eval.md new file mode 100644 index 0000000..0f3fdd9 --- /dev/null +++ b/basics/eval.md @@ -0,0 +1,22 @@ +--- +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 +```