All two are get stdin, and end stdin at EOF, output stdout.
But what does <<-mean?
First look at the instructions in man:
If The redirection operator is <<- , then all leading tab characters is stripped from input lines and the line containing delimiter .
If the redirected operator is <<-, then the tab (tab) will be removed from the beginning of the line where the delimiter (EOF) is located.
this resolves the tabs that are produced by natural indentation in the script.
A little more popular explanation:
When we use cat <<eof, we need to enter the EOF end stdin input on a new line when we are done entering. EOF must be written in the top row and cannot be preceded by tabs or spaces.
For example, the following statement does not go wrong:
Cat <<eofhello,world! Eof
If there are tabs or spaces before the end-of-break EOF, EOF is not treated as an end-delimiter and will only continue to be entered as stdin. and <<-is to solve this problem:
Cat <<-eofhello,world! Eof
the above notation, although there are several tabs and spaces in front of the final EOF, will still be treated as an end delimiter, indicating the end of the stdin. This is the difference between << and <<-.
The difference between cat <<eof and cat <<-eof