diff --git a/.functions b/.functions index 6b0857f7918..90373ae9b4f 100644 --- a/.functions +++ b/.functions @@ -103,19 +103,28 @@ function digga() { # Escape UTF-8 characters into their 3-byte format function escape() { printf "\\\x%s" $(printf "$@" | xxd -p -c1 -u) - echo # newline + # print a newline unless we’re piping the output to another program + if [ -t 1 ]; then + echo # newline + fi } # Decode \x{ABCD}-style Unicode escape sequences function unidecode() { perl -e "binmode(STDOUT, ':utf8'); print \"$@\"" - echo # newline + # print a newline unless we’re piping the output to another program + if [ -t 1 ]; then + echo # newline + fi } # Get a character’s Unicode code point function codepoint() { perl -e "use utf8; print sprintf('U+%04X', ord(\"$@\"))" - echo # newline + # print a newline unless we’re piping the output to another program + if [ -t 1 ]; then + echo # newline + fi } # Show all the names (CNs and SANs) listed in the SSL certificate