2018-03-12 12:34:58 +08:00
|
|
|
# basic expansion test
|
|
|
|
echo {}
|
|
|
|
echo {apple}
|
|
|
|
echo {apple,orange}
|
|
|
|
|
|
|
|
# expansion tests with spaces
|
|
|
|
echo {apple, orange}
|
|
|
|
echo { apple, orange, banana }
|
|
|
|
|
|
|
|
# expansion with spaces and cartesian products
|
|
|
|
echo \'{ hello , world }\'
|
|
|
|
|
|
|
|
# expansion with escapes
|
|
|
|
for phrase in {good\,, beautiful ,morning}; echo -n "$phrase "; end | string trim;
|
|
|
|
for phrase in {goodbye\,,\ cruel\ ,world\n}; echo -n $phrase; end;
|
|
|
|
|
|
|
|
# whitespace within entries converted to spaces in a single entry
|
2019-05-19 02:31:41 +08:00
|
|
|
for foo in {a, hello
|
2018-03-12 12:34:58 +08:00
|
|
|
world }
|
|
|
|
echo \'$foo\'
|
|
|
|
end
|
|
|
|
|
|
|
|
# dual expansion cartesian product
|
2018-03-12 20:50:13 +08:00
|
|
|
echo { alpha, beta }\ {lambda, gamma }, | string replace -r ',$' ''
|
2018-03-12 12:34:58 +08:00
|
|
|
|
|
|
|
# expansion with subshells
|
|
|
|
for name in { (echo Meg), (echo Jo) }
|
|
|
|
echo $name
|
|
|
|
end
|
|
|
|
|
|
|
|
# subshells with expansion
|
|
|
|
for name in (for name in {Beth, Amy}; printf "$name\n"; end); printf "$name\n"; end
|
|
|
|
|
2019-05-19 02:31:41 +08:00
|
|
|
echo {{a,b}}
|
2018-03-12 12:34:58 +08:00
|
|
|
# vim: set ft=fish:
|