In the shell script cat << eof, there is an error output
First, let's look at the normal output;
// An highlighted block
[root@haha ~]# cat test.sh
#!/bin/bash
cat << eof
*******************
test eof
*******************
eof
// An highlighted block
[root@haha ~]# sh test.sh
*******************
test eof
*******************
There is no problem in normal use;
When we use the Tab key when writing a script;
// An highlighted block
[root@haha ~]# cat test.sh
#!/bin/bash
cat << eof
*******************
test eof
*******************
eof
// An highlighted block
[root@haha ~]# sh test.sh
test.sh: line 6: warning: here-document at line 2 delimited by en
d-of-file (wanted `eof') *******************
test eof
*******************
eof
There is an error code;
At this time, we only need to add-after <<
to solve this problem;
// An highlighted block
cat test.sh
#!/bin/bash
cat <<-eof
*******************
test eof
*******************
eof
// An highlighted block
[root@haha ~]# sh test.sh
*******************
test eof
*******************