Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

This article is a Private article. Only a writer and users who know the URL can access it.
Please change open range to public in publish setting if you want to share this article with other users.

More than 1 year has passed since last update.

ターミナルでファイル名をクリップボードコピーする際、改行を取り除く方法(MacOS, echo, pbcopy)

0
Last updated at Posted at 2025-02-26

問題点

ターミナルからファイル名をクリップボードコピーした際、echo ファイル名 | pbcopyではコピーした文字列の末尾に改行がデフォルトで入っていました。

解決策

echoに-nオプションを付与しました。

echo -n ファイル名 | pbcopy

結果

上記問題点は解決し、コーディングが捗りました。

参考資料

必要部分のみ参考とし、今回の問題点と関連づけました。
https://qiita.com/BlackCat_617/items/60ef4e8b191db716d4c5

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?