add to "variable" section

eval command to expand and execute variables
This commit is contained in:
Bonnie I-Man Ng 2019-07-10 16:40:14 +08:00 committed by GitHub
parent 0f1f62f507
commit 055bbc8790
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -987,6 +987,14 @@ echo ${var,,}
helloworld helloworld
``` ```
##### Expand and then execute variable/argument
```bash
cmd="bar=foo"
eval "$cmd"
echo "$bar" # foo
```
## Math ## Math
[[back to top](#handy-bash-one-liners)] [[back to top](#handy-bash-one-liners)]
##### Arithmetic Expansion in Bash (Operators: +, -, *, /, %, etc) ##### Arithmetic Expansion in Bash (Operators: +, -, *, /, %, etc)