LoginSignup
2
2

More than 5 years have passed since last update.

シェルでコピペした文字列をファイルにしたい場合

Posted at

ウェブサイトの複数行の文字列を
コピペしてそのまま新規ファイルなどに書き込みたい場合
以下のようなことをするとサクッとできます。

$ cat << 'EOF' > foo.txt
ここにテキストを入れる
改行も入る
EOF

上の場合EOFを書くかCtrl-dを押すまで入力できます。
(Ctrl-cはキャンセル)

$ cat foo.txt
ここにテキストを入れる
改行も入る
2
2
4

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
2
2