10

When I try

cat > myfile << EOF
TEST TEXT
EOF

I just get an empty file. The same using echo command. What's going on? I can only think about something conflicting in the .zshenv profile file, but I have no idea about what it could be...

I am using zsh 4.3.6 (x86_64-suse-linux-gnu).

Update It now works with zsh 5.0.5 (x86_64-suse-linux-gnu)

Alex Gidan
  • 2,619
  • 17
  • 29
  • 3
    Works for me in zsh 4.3.9. – Barmar Jul 03 '14 at 09:24
  • 4
    works for me in Zsh 5.0.5. Please start zsh with `zsh -f` and retry. `zsh -f` is to ignore any configuration files you have, i.e. that is a zsh with all configs at default values. – Francisco Jul 10 '14 at 08:14

2 Answers2

10

Here is another way to write it:

cat <<eos > filename
foo bar baz
eos

That works in zsh.

sujeet
  • 310
  • 2
  • 8
Rob Jens
  • 584
  • 6
  • 8
0

This could happen if your /tmp (or wherever your $TMPDIR points) were read-only.

You should be able to discover what's wrong by attaching strace to the zsh you're running the above from, using e.g. strace -ff -s200 -o /tmp/zsh.log -p PID-goes-here from a different shell.

András Korn
  • 171
  • 6