]> git.plutz.net Git - confetti/commitdiff
omit empty teltype when exporting csv
authorPaul Hänsch <paul@plutz.net>
Fri, 5 Feb 2021 01:50:05 +0000 (02:50 +0100)
committerPaul Hänsch <paul@plutz.net>
Fri, 5 Feb 2021 01:50:05 +0000 (02:50 +0100)
cards/export_csv.sh

index a1004f7083bd4c84231c65dbcb409fb9ab2ec699..6f17d1f404e4cb8e442eea62f5361b6e1e9c3f7f 100755 (executable)
@@ -26,7 +26,12 @@ list_item() {
   seq 1 $cnt |while read n; do case $item in
     TEL)
       tel="$(pdi_value "$card" "$item" "$n" |unescape)"
-      [ "$tel" ] && printf '%s: %s\n' "$(l10n "TYPE=$(pdi_attrib "$card" "$item" "$n" TYPE)")" "$tel"
+      ttype="$(pdi_attrib "$card" "$item" "$n" TYPE)"
+      if [ "$tel" -a "$ttype" ]; then 
+        printf '%s: %s\n' "$(l10n "TYPE=$ttype")" "$tel"
+      elif [ "$tel" -a "$ttype" ]; then
+        printf '%s\n' "$tel"
+      fi
       ;;
     GENDER)
       gen="$(pdi_value "$card" "$item" "$n" |unescape)"