Timeline for What is the difference between `cat EOF` and `cat EOT` and when should I use it?
Current License: CC BY-SA 4.0
19 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 5, 2022 at 6:51 | vote | accept | k.Cyborg | ||
| Jun 11, 2022 at 18:18 | comment | added | gbarry | EOF...EOT...in a word (or two), "mnemonic device". I'm so old, I saw EOT as "end of tape". | |
| Jun 11, 2022 at 8:38 | comment | added | IBBoard | I thought so, but worth clarifying the origins for people wondering what "EOF" means and why some strings use "EOT" instead. | |
| Jun 9, 2022 at 21:03 | history | edited | ilkkachu | CC BY-SA 4.0 | added 370 characters in body |
| Jun 9, 2022 at 21:01 | comment | added | ilkkachu | @IBBoard, no particular meaning for the shell that interprets the text, I mean. | |
| Jun 9, 2022 at 20:50 | comment | added | shadowtalker | Might be worth linking to the relevant manual page for GNU Bash: gnu.org/software/bash/manual/bash.html#Here-Documents | |
| Jun 9, 2022 at 19:32 | comment | added | IBBoard | "…no particular meaning to those two strings…" depends on how you define 'meaning'. EOF is generally used to indicate End Of File (en.wikipedia.org/wiki/End-of-file) and in this context the heredoc content is the "file". EOT is likely a reference to End Of Transmission (en.wikipedia.org/wiki/End-of-Transmission_character). Neither do anything special in this context compare to FOO or AUTH_CONF_END or even an intentionally confusing KEEP_GOING_DO_NOT_STOP_HERE, but there is a meaning or convention for the person reading/writing the code. | |
| Jun 9, 2022 at 14:48 | vote | accept | k.Cyborg | ||
| Oct 5, 2022 at 6:51 | |||||
| Jun 8, 2022 at 20:37 | history | edited | ilkkachu | CC BY-SA 4.0 | deleted 24 characters in body |
| Jun 8, 2022 at 20:34 | comment | added | ilkkachu | @StéphaneChazelas, right, right, the shell doesn't have to create the temp file for it. Makes it look rather arcane, too ;) | |
| Jun 8, 2022 at 20:31 | comment | added | Stéphane Chazelas | @ilkkachu to avoid the heredoc being created at all (at least in modern shells, IIRC in earlier versions of the Bourne shell, the here doc would still be created) | |
| Jun 8, 2022 at 20:28 | history | edited | ilkkachu | CC BY-SA 4.0 | added 7 characters in body |
| Jun 8, 2022 at 20:28 | comment | added | ilkkachu | @StéphaneChazelas, why the :|| ? | |
| Jun 8, 2022 at 20:08 | comment | added | Stéphane Chazelas | I've used things like :||:<<'# some comment' for instance to comment out some code up to # some comment for instance. | |
| Jun 8, 2022 at 20:08 | comment | added | Stéphane Chazelas | Beware there are some limitations as to what characters can be used as the delimiter. If it's otherwise a character special to the shell such as ;, (, ', #, then it has to be quoted, and then than means expansions are no longer performed inside. Even when quoted, using newline in the delimiter works in few shells (only dash and ksh93 in the few shells I tried). | |
| Jun 8, 2022 at 19:26 | history | edited | ilkkachu | CC BY-SA 4.0 | added 289 characters in body |
| Jun 8, 2022 at 19:24 | comment | added | Kusalananda♦ | @k.Cyborg The label could be used for documentation, to a degree. For example, your code in the question could use AUTH_CONF_END or a similar label. | |
| Jun 8, 2022 at 19:22 | comment | added | k.Cyborg | Thanks you very much sir! I didn't knew and I was stucked with the classic EOF | |
| Jun 8, 2022 at 19:20 | history | answered | ilkkachu | CC BY-SA 4.0 |