小编Bao*_*CAI的帖子

Bash:forfile中的循环:意外的文件结尾

我正在编写一个Makefile,它将列出a.cpp,b.cpp和ch文件包含的所有头文件.但是,我得到了意外EOF的错误.类似的问题总是由行终止符引起,就像他们在EOL中使用CRLF而不是LF.但是,我的文本编辑器设置为使用LF,我通过删除所有EOL重新检查并重新添加.不幸的是,错误仍然存​​在.以下是代码:

#!/bin/bash

list-header:
    for file in a.cpp b.cpp b.h
    do
        echo "$file includes headers: "
        grep -E '^#include' $file | cut -f2
    done
Run Code Online (Sandbox Code Playgroud)

我收到此错误消息:

for file in "Bigram.cpp client.cpp Bigram.h"
/bin/sh: -c: line 1: syntax error: unexpected end of file"
Run Code Online (Sandbox Code Playgroud)

在此先感谢您的帮助.

bash makefile

9
推荐指数
1
解决办法
5978
查看次数

标签 统计

bash ×1

makefile ×1