Created
April 26, 2012 02:15
-
-
Save shello/2495224 to your computer and use it in GitHub Desktop.
Functions for wrapping text (80 columns default); and a pbpaste/pbcopy shortcut function.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ncols() { fold -s -w ${1:-80}; } | |
function pbncols() { | |
command -v pbpaste >/dev/null 2>&1 && command -v pbcopy >/dev/null | |
if [[ $? != 0 ]]; then | |
echo >&2 "pbpaste and pbcopy are required. Aborting." | |
return 1 | |
fi | |
pbpaste | ncols $1 | pbcopy | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tested with bash 3.2.48 and zsh 4.3.17.
Usage:
pbncols, under Mac OS X, will wrap the text in your pasteboard, and put it back there.