3
4

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.

Macのクリップボードの改行を消すコマンド

Last updated at Posted at 2020-04-19

環境

  • macOS Catalina 10.15.4

コマンド

このコマンドでクリップボードの改行を消すことができる。

$ echo `pbpaste` | pbcopy

自作コマンドにした

~/binnn.shというファイルを作り、先ほどの一行を書き込んだ。(nnはNo \nという意味を込めた。)

nn.sh
echo `pbpaste` | pbcopy

.zshrcにエイリアスを書き込む。(bashの人は.bashrc)

alias nn='sh ~/bin/nn.sh'

.zshrcをアクティベート。

$ source .zshrc

これで何かしらをコピーしたときに、nnコマンドを実行することでコピーした文章から改行コードが消える。

$ nn
3
4
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
3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?