Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/performance/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Shell 这里有文件注释_Shell_Heredoc - Fatal编程技术网

Shell 这里有文件注释

Shell 这里有文件注释,shell,heredoc,Shell,Heredoc,我在这里的文档中找不到关于符号的太多解释。在我的shell脚本中,我正在用gnuplot绘制一个文件 此代码适用于: gnuplot <<- EOF set xlabel "square dimension (inches)" set ylabel "mean survival time (seconds)" set term png set output "${plot_file}.png"

我在这里的文档中找不到关于符号的太多解释。在我的shell脚本中,我正在用gnuplot绘制一个文件

此代码适用于:

gnuplot <<- EOF
         set xlabel "square dimension (inches)"
         set ylabel "mean survival time (seconds)"
         set term png
         set output "${plot_file}.png"
         plot "beetle.dat" using 1:2
EOF
这个问题以前可能有人问过,但是由于无法识别特殊字符,我无法搜索它。

当你说“此代码”时,是该代码还是缩进的

默认情况下,Heredocs查找只包含分隔符的行,因此没有前导制表符或空格。“-”的作用是删除前导制表符,这样您就可以按照代码的其余部分漂亮地缩进herdoc(内容和分隔符)

因此,如果您的分隔符在代码中实际缩进,则只能找到带“-”的分隔符


见其缩进部分中的3.6.6。我直接从源代码中复制了它。实际上,假设第一行与其余行缩进到同一列,直到EOF。我会修好的。
./myscript: line 118: warning: here-document at line 104 delimited by end-of-file (wanted `EOF')
./myscript: line 119: syntax error: unexpected end of file