1

I have a bash script that reads files, and replace chars. I have that to work but for some reason, the \n or \r are not showing ...

so for example I have a file: /tmp/a

abc
123
xyz
987

When I do:

  #!/bin/bash

  a=$(cat a)
  // replace stuff here (this works)
  echo -e $a

it shows:

abc xyz 987

BUT I want to show:

abc
xyz
987

how can I show the NL or CR therE?

Pat R Ellery
  • 1,696
  • 3
  • 22
  • 40

1 Answers1

2

Quoting issue:

echo -e "$a"

keeps the newlines.

Jens
  • 69,818
  • 15
  • 125
  • 179