-
-
Save hitode909/370647 to your computer and use it in GitHub Desktop.
便利クリップボードコマンド
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/sh | |
# 便利クリップボード | |
# 入力なし => paste | |
# 入力あり,引数なし => | copy | |
# 入力あり,引数あり => | grep $* | copy | |
function pb() | |
{ | |
if [ -t 0 ]; then | |
pbpaste | |
else | |
if [ $# -gt 0 ]; then | |
a=$(cat - | grep $*) | |
else | |
a=$(cat -) | |
fi | |
echo $a | |
echo -n $a | pbcopy | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
cool!