Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/rust/4.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
如何在bash中连接路径(在文件中读取)和字符串?_Bash_Carriage Return - Fatal编程技术网

如何在bash中连接路径(在文件中读取)和字符串?

如何在bash中连接路径(在文件中读取)和字符串?,bash,carriage-return,Bash,Carriage Return,我在百分之八。我有一个包含很多uri的文件: /var/log/toto/*.log /var/log/tata/*.log 我在读取行时使用,读取行,并在每个路径的末尾添加一个字符串: #!/bin/bash while read line do echo "$line""-20201117.gz" done < "/opt/scripts/folders.conf" 为什么??我想

我在百分之八。我有一个包含很多uri的文件:

/var/log/toto/*.log
/var/log/tata/*.log
我在读取行时使用
读取行,并在每个路径的末尾添加一个字符串:

#!/bin/bash

    while read line
    do
        echo "$line""-20201117.gz"
    done < "/opt/scripts/folders.conf"

为什么??我想:
/var/log/toto/*.log-20201117.gz
有人能帮我吗?

我可以在Linux系统上使用带有Windows样式CRLF行结尾的文件复制此文件。通过
dos2unix
或类似程序运行文件,将行尾转换为LF。

我可以在Linux系统上使用带有Windows样式CRLF行尾的文件复制此文件。通过
dos2unix
或类似程序运行文件,将行尾转换为LF。

我做了相同的测试,得到了相同的结果。使用
而IFS=$'\t\n\r“read-r line
可能是另一种选择。我做了相同的测试,得到了相同的结果。使用
而IFS=$'\t\n\r“read-r行
可能是另一种选择。
-20201117.gzo/*.log
-20201117.gza/*.log