0

I want to add some text to a file.

Using the following command:

$ cat > file

And getting the following error:

cat: -: Resource temporarily unavailable

What is happening? how to debug this?

manish ma
  • 101
  • 2
    Try running this into the same terminal perl -MFcntl -e 'fcntl STDIN, F_SETFL, fcntl(STDIN, F_GETFL, 0) & ~O_NONBLOCK' –  Oct 06 '20 at 08:48
  • This solved the issue ^^ Thanks a lot. Can you explain please? – manish ma Oct 06 '20 at 08:50
  • 3
    That is turning the non-blocking mode back off (to normal). Since cat is designed to read in blocking mode, it will exit with an error when reading from stdin fails with an EAGAIN error. Now the problem is to determine which program you have run has messed up your terminal ;-) –  Oct 06 '20 at 08:52

1 Answers1

0

Below is running fine on RHEL5

$ cat > file 

It appears you are trying to write contents to a file from stdin. Try this

$ cat - > file

- indicates standard input

mtk
  • 27,530
  • 35
  • 94
  • 130
  • Still the same error. I'm running on: 5.4.0-48-generic #52~18.04.1-Ubuntu SMP Thu Sep 10 12:50:22 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux – manish ma Oct 06 '20 at 08:49