0
var1=$(printf "\n\x0A\n")

var2=$(printf "\na\nb\nc")

Using Android Terminal, the output of echo -e "$var1" (same for echo and printf) iss nothing, not even the 3 new lines. But echo -e "$var2" or echo "$var2" or printf "$var2" output:

a
b
c

How come $var2's output includes the whitespace character but not $var1?

(\n and \x0A have the exact same behaviour.)

muru
  • 72,889
neverMind9
  • 1,690

1 Answers1

0

Why would you print a result of a printf?

var1="\n\x0A\n"
var2="\na\nb\nc"

printf $var1
printf $var2

that should work.

*nix system - LF, 0x0A (dec 10) \n as line ending

windows OS - CR LF, 0x0D 0x0A (dec: 13 10) \r \n as line ending.

Michael D.
  • 2,830