Skip to main content
typo
Source Link
phemmer
  • 73.9k
  • 21
  • 199
  • 231

You're overthingingoverthinking it. All you need is this:

cat > texttest.txt

Cat will read from STDIN if you've not told it different. Since it's reading from STDIN, it will react to the control character Ctrl+D without your having to specify it. And since Ctrl+D is the only thing that will finish the cat subprocess, you don't even need to wrap it in a loop.

You're overthinging it. All you need is this:

cat > texttest.txt

Cat will read from STDIN if you've not told it different. Since it's reading from STDIN, it will react to the control character Ctrl+D without your having to specify it. And since Ctrl+D is the only thing that will finish the cat subprocess, you don't even need to wrap it in a loop.

You're overthinking it. All you need is this:

cat > texttest.txt

Cat will read from STDIN if you've not told it different. Since it's reading from STDIN, it will react to the control character Ctrl+D without your having to specify it. And since Ctrl+D is the only thing that will finish the cat subprocess, you don't even need to wrap it in a loop.

Source Link
Jenny D
  • 13.3k
  • 3
  • 42
  • 55

You're overthinging it. All you need is this:

cat > texttest.txt

Cat will read from STDIN if you've not told it different. Since it's reading from STDIN, it will react to the control character Ctrl+D without your having to specify it. And since Ctrl+D is the only thing that will finish the cat subprocess, you don't even need to wrap it in a loop.