mirror of
https://github.com/onceupon/Bash-Oneliner.git
synced 2024-11-26 06:17:01 +00:00
Variable substitution changes
Clarify documentation and give a few more examples
This commit is contained in:
parent
c2b96736bd
commit
dc268515b7
12
README.md
12
README.md
@ -135,9 +135,19 @@ $HOSTNAME current hostname
|
|||||||
##### Variable substitution within quotes
|
##### Variable substitution within quotes
|
||||||
```bash
|
```bash
|
||||||
# foo=bar
|
# foo=bar
|
||||||
|
echo $foo
|
||||||
|
# bar
|
||||||
|
echo "$foo"
|
||||||
|
# bar
|
||||||
|
# single quotes cause variables to not be expanded
|
||||||
|
echo '$foo'
|
||||||
|
# $foo
|
||||||
|
# single quotes within double quotes will not cancel expansion and will be part of the output
|
||||||
echo "'$foo'"
|
echo "'$foo'"
|
||||||
# 'bar'
|
# 'bar'
|
||||||
# double/single quotes around single quotes make the inner single quotes expand variables
|
# doubled single quotes act as double quotes making variables expand
|
||||||
|
echo ''$foo''
|
||||||
|
# bar
|
||||||
```
|
```
|
||||||
##### Get the length of variable
|
##### Get the length of variable
|
||||||
```bash
|
```bash
|
||||||
|
Loading…
Reference in New Issue
Block a user