From 4cb85271cc6cf9f7414c237627f31596ffc8b99b Mon Sep 17 00:00:00 2001 From: BarbUk Date: Sat, 22 Dec 2018 16:22:43 +0400 Subject: [PATCH] Remove last EOL added by awk substitution --- snippy | 3 +++ 1 file changed, 3 insertions(+) diff --git a/snippy b/snippy index 8dcaf54..e4ef80f 100755 --- a/snippy +++ b/snippy @@ -134,6 +134,9 @@ run() { -v placeholder="$clipboard_placeholder" \ '{ gsub(placeholder, clipboard); print }' > "$tmpfile" + # remove last EOL + perl -pi -e 'chomp if eof' "$tmpfile" + else [[ ${snippet} =~ ^$ ]] ${snippet##*$} 2>/dev/null > "$tmpfile" # execute as bashcommand fi