1
0
Fork 0
dotfiles/bin/cbedit

10 lines
322 B
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
# Somehow (last observed on a Mac), this pipeline ends up with a bunch of
# newlines at the end that make pasting it annoying. Use sed to remove all
# trailing newlines.
#
# https://stackoverflow.com/a/7359879/2472163
cbpaste | vipe | sed -e :a -e '/^\n*$/{$d;N;};/\n$/ba' | cbcopy