Hello,
I'll repost the question from earlier to get some more eyes on it, just wanna avoid spamming...
I'm currently doing the Linux fundamentals module and I found something I dont quite understand...
If I run
$ cat << EOF > test.txt
I get the expected input from STDIN into the file.
However I played around a bit more and found this:
$ cat << EOF << EOF > test.txt
This requires me to use EOF twice before it actually quits and it sends everything I send (even after the first EOF) to the file...
I thought it would error out or something... or somehow try to create a second file given taht the signal is called "End of File"
I know this is not really "useful" but I just wanna understand whats going on.
Is the first EOF deleted as the second one comes around wrapped or somehow ?
In addition I also found this:
$ cat << EOF << SIGKILL << EOF > test1.txt
heredoc> test 1
heredoc> EOF
heredoc> SIGKILL
heredoc> test2
heredoc> EOF
In my head the SIGKILL should kill the cat process before it can receive the final input right ?
Can someone explain to me whats happening here ? What am I missing ?