raforg / danectl

DNSSEC DANE implementation manager
https://raf.org/danectl
GNU General Public License v2.0
22 stars 5 forks source link

echo does not interpret backslash escapes #6

Closed razorsedge closed 2 years ago

razorsedge commented 2 years ago

Things like echo "$domain\tIN\tTLSA\t3 1 1 $hash_current" will print out literal \t strings. Use echo -e to print out tabs.

razorsedge commented 2 years ago
--- danectl-0.7.3/danectl-orig  2021-12-21 00:55:20.000000000 -0700
+++ danectl-0.7.3/danectl   2022-07-24 14:46:23.636065201 -0700
@@ -748,7 +748,7 @@
    for t in $tlsa
    do
        domain="`case \"$t\" in *.) echo $t;; *) echo $t.$certname.;; esac`"
-       echo "$prefix$domain\tIN\tTLSA\t3 1 1 $hash"
+       echo -e "$prefix$domain\tIN\tTLSA\t3 1 1 $hash"
    done
 }

@@ -791,7 +791,7 @@
        else
            [ "$missing" = 0 ] && echo "; Missing $certname current (must be published)"
            missing=1
-           echo "$domain\tIN\tTLSA\t3 1 1 $hash_current"
+           echo -e "$domain\tIN\tTLSA\t3 1 1 $hash_current"
        fi
    done
    missing=0
@@ -804,7 +804,7 @@
        else
            [ "$missing" = 0 ] && echo "; Missing $certname next (must be published)"
            missing=1
-           echo "$domain\tIN\tTLSA\t3 1 1 $hash_next"
+           echo -e "$domain\tIN\tTLSA\t3 1 1 $hash_next"
        fi
    done
    superfluous=0
raforg commented 2 years ago

Hi, Thanks for that. But it was fixed some time ago. It's in the git repository, but I hadn't created a new release yet. Sorry about that. I'll do it now (v0.7.4). By the way, echo -e is not that portable either. Changing it to the printf command is the most portable way of doing this.