Skip to content

Instantly share code, notes, and snippets.

@hitode909
Created April 19, 2010 00:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hitode909/370647 to your computer and use it in GitHub Desktop.
Save hitode909/370647 to your computer and use it in GitHub Desktop.
便利クリップボードコマンド
#! /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
}
@jugyo
Copy link

jugyo commented Apr 19, 2010

cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment