bash脚本输出文件名中的奇怪符号

问题描述 投票:0回答:1

我有一个bash脚本,它使用一个文本文件'power_coords.txt',其中包含115行数据,并且在每行中有四列(以空格分隔)包含x,y,z坐标(前3个列)和一个名称(第4列)。示例:

36 54 19 cotc1
45 13 -27 cotc2
1 -6 14 cotc3
....

我的脚本运行以下代码行以在文本文件的每一行上运行操作:

#!/bin/bash
input="power_coords.txt"  
while IFS=" " read x y z name
do  
fslmaths avg152T1.nii.gz -mul 0 -add 1 -roi $x 1 $y 1 $z 1 0 1 $name -odt float
done < "$input"

这似乎很好用,但是当我运行代码时,在创建的每个文件名中都有一个奇怪的符号:enter image description here

有人知道为什么会这样以及如何解决吗?还是在脚本运行后清理文件名的简单方法(即删除看起来像乐高的位)?

欢呼声

linux bash rename filenames symbols
1个回答
0
投票

屏幕快照中的小方块显示为“ 000D”,所以它只是一个CR newline symbol

© www.soinside.com 2019 - 2024. All rights reserved.