4 ms·
There is also the variable-expansion abort, even with optional custom error message: "${VAR:?Error message goes here}" Will exit2 if VAR is unset or the e
by mioelnir 11y ago
There is also the variable-expansion abort, even with optional custom error message:
"${VAR:?Error message goes here}"
Will exit2 if VAR is unset or the empty string.
Or, which I often use, build the path you want to delete, call realpath on it - then check if your base directory you never ever have any business leaving is a prefix string of the realpath resolved path. This still allows to symlink stuff into subdirectories but will catch if something resolves suddenly all over the place.