commit 9aa83027868b6661cf926ed603750a6e0ecfa705 parent 074e44d2375374910333f7354c1b54dc80deb265 Author: Cem Keylan <cem@ckyln.com> Date: Fri, 6 Nov 2020 23:21:04 +0300 get_domains(): simplify Diffstat:
M | bin/muw | | | 17 | +++++++---------- |
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/bin/muw b/bin/muw @@ -142,16 +142,13 @@ test_connection() { } get_domains() { - [ -f "$confdir/domains.csv" ] && { - if [ -f "$sharedir/domains.csv" ]; then - sort -u -o "$confdir/domains.csv" "$sharedir/domains.csv" "$confdir/domains.csv" - else - sort -u -o "$confdir/domains.csv" "$confdir/domains.csv" - fi - return - } - :> "$confdir/domains.csv" - [ -f "$sharedir/domains.csv" ] && cp "$sharedir/domains.csv" "$confdir/domains.csv" + if [ -f "$confdir/domains.csv" ]; then + { [ -f "$sharedir/domains.csv" ] && cat "$sharedir/domains.csv" + cat "$confdir/domains.csv" ;} | sort -uo "$confdir/domains.csv" + else + { [ -f "$sharedir/domains.csv" ] && cat "$sharedir/domains.csv" + } > "$confdir/domains.csv" + fi } set_mbsync() {