14
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

cygwin, linux で pbcopy/pbpaste

Posted at

cygwin

putclip, getclip ってのがある。
仮に無いとしても、/dev/clipboard を閲覧すれば良い。

alias pbcopy='cat >/dev/clipboard'
alias pbpaste='cat /dev/clipboard'
  • 日本語環境の齟齬云々があるので、必要な人は、nkf など挟む。
  • 改行コード云々も。

linux

CentOS

linux だと xsel が良いらしい1ので、ソースからインストール

$ wget -q http://www.vergenet.net/~conrad/software/xsel/download/xsel-1.2.0.tar.gz
$ tar zxf xsel-1.2.0.tar.gz 
$ cd xsel-1.2.0/
$ ./configure --prefix=${HOME}/cmd
$ make
$ make install
  • ssh 越しに xsel を使用しようとすると、例え、 linux 側だけで完結させるつもりでも、結構工夫が必要っぽい。今の所は必要としないので、そのまま使う。

で、

.*shrc

case ${OSTYOE} in
	darwin*)
		:
		;;
	cygwin*)
		alias pbpaste=/usr/bin/getclip.exe
		alias pbcopy=/usr/bin/putclip.exe
		;;
	*)
		alias pbpaste='xsel -b'
		alias pbcopy='xsel -b'
		;;
esac

的な事を書いとく。

  1. xclip は日本語が駄目だとかなんとか。今の時点では違うのかもしれないが。

14
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?