-
Notifications
You must be signed in to change notification settings - Fork 1.8k
SC2115
Vidar Holen edited this page Oct 4, 2015
·
5 revisions
rm -rf "$STEAMROOT/"*
rm -rf "${STEAMROOT:?}/"*
If STEAMROOT
is empty, this will end up deleting everything in the system's root directory.
Using :?
will cause the command to fail if the variable is null or unset. Similarly, you can use :-
to set a default value if applicable.
In the case command substitution, assign to a variable first and then use :?
. This is relevant even if the command seems simple and obviously correct, since forks and execs can fail due to external system limits and conditions, resulting in a blank substitution.
None.