From 055bbc879041770cc3a14a83117e1c9073f65170 Mon Sep 17 00:00:00 2001 From: Bonnie I-Man Ng Date: Wed, 10 Jul 2019 16:40:14 +0800 Subject: [PATCH] add to "variable" section eval command to expand and execute variables --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 4c89438..fea08de 100644 --- a/README.md +++ b/README.md @@ -987,6 +987,14 @@ echo ${var,,} helloworld ``` + +##### Expand and then execute variable/argument +```bash +cmd="bar=foo" +eval "$cmd" +echo "$bar" # foo +``` + ## Math [[back to top](#handy-bash-one-liners)] ##### Arithmetic Expansion in Bash (Operators: +, -, *, /, %, etc)