moby/builder/words
Doug Davis 39908fc6d9 Add support for more advanced ${xxx:...} syntax
Just ${xxx:+...} and ${xxx:-...} for now

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-04-01 08:11:15 -07:00

58 lines
2.1 KiB
Text

hello | hello
he'll'o | hello
he'llo | hello
he\'llo | he'llo
he\\'llo | he\llo
abc\tdef | abctdef
"abc\tdef" | abc\tdef
'abc\tdef' | abc\tdef
hello\ | hello
hello\\ | hello\
"hello | hello
"hello\" | hello"
"hel'lo" | hel'lo
'hello | hello
'hello\' | hello\
"''" | ''
$. | $.
$1 |
he$1x | hex
he$.x | he$.x
he$pwd. | he.
he$PWD | he/home
he\$PWD | he$PWD
he\\$PWD | he\/home
he\${} | he${}
he\${}xx | he${}xx
he${} | he
he${}xx | hexx
he${hi} | he
he${hi}xx | hexx
he${PWD} | he/home
he${.} | error
he${XXX:-000}xx | he000xx
he${PWD:-000}xx | he/homexx
he${XXX:-$PWD}xx | he/homexx
he${XXX:-${PWD:-yyy}}xx | he/homexx
he${XXX:-${YYY:-yyy}}xx | heyyyxx
he${XXX:YYY} | error
he${XXX:+${PWD}}xx | hexx
he${PWD:+${XXX}}xx | hexx
he${PWD:+${SHELL}}xx | hebashxx
he${XXX:+000}xx | hexx
he${PWD:+000}xx | he000xx
'he${XX}' | he${XX}
"he${PWD}" | he/home
"he'$PWD'" | he'/home'
"$PWD" | /home
'$PWD' | $PWD
'\$PWD' | \$PWD
'"hello"' | "hello"
he\$PWD | he$PWD
"he\$PWD" | he$PWD
'he\$PWD' | he\$PWD
he${PWD | error
he${PWD:=000}xx | error
he${PWD:+${PWD}:}xx | he/home:xx
he${XXX:-\$PWD:}xx | he$PWD:xx
he${XXX:-\${PWD}z}xx | he${PWDz}xx