gpt4 book ai didi

linux - bash中的换行符

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:29:07 32 4
gpt4 key购买 nike

我目前正在编写一个 bash scipt,我需要在其中连接输出变量中的结果。但是我需要用换行符 '\n' 分隔它们,这似乎不起作用......有什么想法吗???

#!/bin/bash

for i in "./"*
do

#echo "$i"
tmp=$('/home/eclipseWorkspace/groundtruthPointExtractor/Debug/groundtruthPointExtractor' "./"$i)
#echo $Output
#printf "$i $Output\n">> output.txt
Output=$Output$(printf $'\n %s %s' "$i" "$tmp" )
done
echo $Output
echo $Output> output.txt

最佳答案

看起来不错

echo “$str”有效

因为当你打印不带引号的字符串时,换行符被转换为空格!!!

关于linux - bash中的换行符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21333501/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com