Created
September 5, 2015 14:15
-
-
Save ma6174/1235d148902629a60f72 to your computer and use it in GitHub Desktop.
run a command and copy result to clipboard, or copy data from stdin.
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
#!/bin/bash | |
if [ $# -gt 0 ]; then | |
(echo "$ "$@ && exec $@) | tee /dev/fd/2 | pbcopy | |
else | |
tee /dev/fd/2 | perl -pe 'chomp if eof' | pbcopy | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment