2 added 7 characters in body
source | link

All shells I tested read a here-document just fine even without the terminator, the here-doc will just end at end-of-file then. Bash gives a warning about this, but busybox/dash/ksh and zsh just handle it silently.

E.g.

$ cat heredoctest.sh
#!/bin/bash
cat -n <<EOF
foo
bar
$ bash heredoctest.sh
heredoctest.sh: line 4: warning: here-document at line 2 delimited by end-of-file (wanted `EOF')
     1  foo
     2  bar

But the particular sample of code you present seems like an error. As it's written, it would just append the if statement-statement to myPath/myFile.append, which doesn't seem too useful. It looks like the here-doc contents and the terminator are just missing from between the cat and the if.

All shells I tested read a here-document just fine even without the terminator, the here-doc will just end at end-of-file then. Bash gives a warning about this, but busybox/dash/ksh and zsh just handle it silently.

E.g.

$ cat heredoctest.sh
#!/bin/bash
cat -n <<EOF
foo
bar
$ bash heredoctest.sh
heredoctest.sh: line 4: warning: here-document at line 2 delimited by end-of-file (wanted `EOF')
     1  foo
     2  bar

But the particular sample of code you present seems like an error. As it's written, it would just the if statement to myPath/myFile.append, which doesn't seem too useful. It looks like the here-doc contents and the terminator are just missing from between the cat and the if.

All shells I tested read a here-document just fine even without the terminator, the here-doc will just end at end-of-file then. Bash gives a warning about this, but busybox/dash/ksh and zsh just handle it silently.

E.g.

$ cat heredoctest.sh
#!/bin/bash
cat -n <<EOF
foo
bar
$ bash heredoctest.sh
heredoctest.sh: line 4: warning: here-document at line 2 delimited by end-of-file (wanted `EOF')
     1  foo
     2  bar

But the particular sample of code you present seems like an error. As it's written, it would just append the if-statement to myPath/myFile.append, which doesn't seem too useful. It looks like the here-doc contents and the terminator are just missing from between the cat and the if.

1
source | link

All shells I tested read a here-document just fine even without the terminator, the here-doc will just end at end-of-file then. Bash gives a warning about this, but busybox/dash/ksh and zsh just handle it silently.

E.g.

$ cat heredoctest.sh
#!/bin/bash
cat -n <<EOF
foo
bar
$ bash heredoctest.sh
heredoctest.sh: line 4: warning: here-document at line 2 delimited by end-of-file (wanted `EOF')
     1  foo
     2  bar

But the particular sample of code you present seems like an error. As it's written, it would just the if statement to myPath/myFile.append, which doesn't seem too useful. It looks like the here-doc contents and the terminator are just missing from between the cat and the if.