blob: 276a2e6803a4ce6a5c5190e218bb7a9719ae39c8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
---
tags:
- bash
---
[[Bash]] [[Process substition (tmp file)]] [[Parameter subsitution]]
---
[This](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02) page contains a table with [[Parameter subsitution]]
When we want to expand a variable into an argument to a command but the variable is empty it will expand to **an empty string**. This is often unwanted, we just want `null` which is removed from the command-line.
*Example*
```
openstack server delete server "${waitFlag}"
```
if `waitFlag` is empty this will become:
```
openstack server delete server ''
```
which results in an error.
This is where we can use `null substitution`:
```
openstack server delete server "${waitFlag:+$waitFlag}"
```
|