Before if the ‘curl’ command failed, it wouldn't send any output to sed, which
would succeed, and that would go into the destination file.
Now we check the status explicitly before moving on and print a message when
‘curl’ fails.
If there is no configuration file in “$XDG_CONFIG_HOME/update-mirrors”,
try looking through directories specified in XDG_CONFIG_DIRS. If
XDG_CONFIG_DIRS is not specified, use “/etc/xdg”.
Now config files are searched for in this order:
- “$XDG_CONFIG_HOME/update-mirrors/config.sh”, or
“$HOME/.config/update-mirrors/config.sh” if XDG_CONFIG_DIR is not
defined.
- For each DIR in XDG_CONFIG_DIRS “$DIR/update-mirrors/config.sh” is
tried, or “/etc/xdg/update-mirrors/config.sh” if XDG_CONFIG_DIRS is
not defined.