我试图在我的shell脚本中使用此示例
#!/bin/sh HOST='ftp.users.qwest.net' USER='yourid' PASSWD='yourpw' FILE='file.txt' ftp -n $HOST <<END_SCRIPT quote USER $USER quote PASS $PASSWD put $FILE quit END_SCRIPT #### My code # #但由于<<END_SCRIPT ,vim没有语法突出显示超出该行的任何内容。 我正在使用red hat linux 5 Source for code snippet http://www.stratigery.com/scripting.ftp.html
编辑:可能是我的问题不明确。 Eveyone评论说vim无法突出heredocs。 但在heredoc之后我更关注代码。 我应该提到即使在heredoc结束后代码也不会突出显示。 弄清楚这是一个问题,因为END_SCRIPT应该从行的开头开始(中间没有空格) 。
I am trying to use this example in my shell script
#!/bin/sh HOST='ftp.users.qwest.net' USER='yourid' PASSWD='yourpw' FILE='file.txt' ftp -n $HOST <<END_SCRIPT quote USER $USER quote PASS $PASSWD put $FILE quit END_SCRIPT #### My code # #But because of the <<END_SCRIPT , vim does not syntax highlights anything beyond that line. I am using red hat linux 5 Source for code snippet http://www.stratigery.com/scripting.ftp.html
EDIT: May be my question was not clear. Eveyone has commented about vim not being able to highlight heredocs. But I was more concern about the code after heredoc. I should have mentioned that code is not highlighted even after heredoc is ended. Figured out that it was a problem because there END_SCRIPT should start at the beginning of the line (no space in between).
最满意答案
从<<END_SCRIPT到行<<END_SCRIPT的下一个实例之后的行的区域是一个heredoc,它基本上是一个多行字符串文字。 vim强调它是这样的,因为heredoc可以诚实地只包含任意数据,并且没有好的方法让vim知道如何处理它开箱即用。
I already edited my question to mention how I resolved the issue. But mentioning it here as an answer to be consistent with the format.
The heredoc was not ended because I has space between the start of the line and "END_SCRIPT".
更多推荐
发布评论