obelix obelix - 3 months ago 30
Linux Question

new line character in bash

I am currently writing a bash scipt where i need to concatenate the results within the output variable. However I need them to be seperated by newline charcater '\n' which does not seem to work... Any ideas ???


for i in "./"*

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


Well looks like

echo "$str" works

because when you print the string without quotes, newline are converted to spaces !!!