| 1 |
= Alternation Syntax |
| 2 |
|
| 3 |
Alternation syntax similar to that used in Unix shells may also be |
| 4 |
used: |
| 5 |
|
| 6 |
`%{%{Foo}:-bar}` |
| 7 |
|
| 8 |
This code returns the value of `%{Foo}`, if it has a value. |
| 9 |
Otherwise, it returns a literal string bar. |
| 10 |
|
| 11 |
`%{%{Foo}:-%{Bar}}` |
| 12 |
|
| 13 |
This code returns the value of `%{Foo}`, if it has a value. |
| 14 |
Otherwise, it returns the expansion of `%{Bar}`. |
| 15 |
|
| 16 |
These conditional expansions can be nested to almost any depth, such |
| 17 |
as with `%{%{One}:-%{%{Two}:-%{Three}}}`. |
| 18 |
|
| 19 |
.Examples |
| 20 |
`%{%{Stripped-User-Name}:-%{User-Name}}` + |
| 21 |
`%{%{Framed-IP-Address}:-<none>}` |
| 22 |
|
| 23 |
// Copyright (C) 2020 Network RADIUS SAS. Licenced under CC-by-NC 4.0. |
| 24 |
// Development of this documentation was sponsored by Network RADIUS SAS. |