diff options
author | Mathias Bynens <mathias@qiwi.be> | 2013-03-26 15:22:58 +0100 |
---|---|---|
committer | Mathias Bynens <mathias@qiwi.be> | 2013-03-26 15:22:58 +0100 |
commit | 7e824c8dd7010e558f319f73a7ffaf76f95a410f (patch) | |
tree | a8336c2586e279f81e844f043387dc352f20c9a5 /.functions | |
parent | 89274254b53bc1ad4931d1ccc70bbca4aea4166a (diff) | |
download | dotfiles-7e824c8dd7010e558f319f73a7ffaf76f95a410f.tar.gz dotfiles-7e824c8dd7010e558f319f73a7ffaf76f95a410f.tar.bz2 dotfiles-7e824c8dd7010e558f319f73a7ffaf76f95a410f.zip |
.functions: Print trailing newlines when not piping the output
Diffstat (limited to '.functions')
-rw-r--r-- | .functions | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -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 |