'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 1:[1]

FWIW in the console/terminal I have always used:

cat > a.txt
line 1111
line 2222
Ctrl+D

It worked both in Bash and Fish.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 martin-g