Search code examples
catfish

How to write multilines to a file with fish?


In bash, I can do:

cat >a.txt <<EOF
line 1111
line 2222
EOF

But this is invalid syntax when using in fish. What's the correct way to do it?


Solution

  • You can use echo and a multiline string (adapted from this thread in the fish issue tracker)

    echo >a.txt "\
    line 1111
    line 2222"