mirror of
https://github.com/onceupon/Bash-Oneliner
synced 2024-11-25 06:00:18 +00:00
Merge pull request #33 from JacksonBailey/patch-1
Variable substitution changes
This commit is contained in:
commit
8b2e16f0c1
1 changed files with 13 additions and 3 deletions
16
README.md
16
README.md
|
@ -135,9 +135,19 @@ $HOSTNAME current hostname
|
|||
##### Variable substitution within quotes
|
||||
```bash
|
||||
# foo=bar
|
||||
echo "'$foo'"
|
||||
#'bar'
|
||||
# double/single quotes around single quotes make the inner single quotes expand variables
|
||||
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'"
|
||||
# 'bar'
|
||||
# doubled single quotes act as double quotes making variables expand
|
||||
echo ''$foo''
|
||||
# bar
|
||||
```
|
||||
##### Get the length of variable
|
||||
```bash
|
||||
|
|
Loading…
Reference in a new issue