[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Printf bug?



Hi, 

the command printf seems to be ignoring the ending '\n' that passes to it:

$ test=`/usr/bin/printf "1\n a\n "`

$ echo "$test<end>"
1
 a
 <end>

$ test=`/usr/bin/printf "1\n a\n"`

$ echo "$test<end>"
1
 a<end>

The only different between 2nd and 1st assignment of test is the ending " ". 

I need the ending "\n" to place "<end>" at next line after "a", without
the leading space. How can I do that? 

thanks

PS, my printf:

$ /usr/bin/printf --version
printf (GNU coreutils) 5.2.1
Written by David MacKenzie.





Reply to: