A better way

Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
Jack L. Frost 2019-11-24 14:00:32 +03:00
parent 03e0fda896
commit 4e1d3a7bcd

2
ufw
View File

@ -357,10 +357,10 @@ main() {
fi fi
cfg_url_regex='^[A-Za-z]([A-Za-z0-9+.-]+)?://.+' cfg_url_regex='^[A-Za-z]([A-Za-z0-9+.-]+)?://.+'
cfg_file=${UFW_CFG_FILE:-"$XDG_CONFIG_DIR/ufw"}
[[ $1 ]] || { usage; return 1; } [[ $1 ]] || { usage; return 1; }
[[ $UFW_CFG_FILE ]] && cfg_file=$UFW_CFG_FILE
if [[ -f "$cfg_file" ]]; then if [[ -f "$cfg_file" ]]; then
if ! source "$cfg_file"; then if ! source "$cfg_file"; then
printf 'Failed to source configuration file: %s\n' "$cfg_file" printf 'Failed to source configuration file: %s\n' "$cfg_file"