shell bash add tag
Prabhjot Singh
I'm using a variable that contains multi-line string. When I write 

```bash
echo -n "This is a two

line string."
```

`echo -n` does not suppress newline. So far as I know `-n` ( or `\c` on some systems) suppresses newlines. What I'm missing?

PS: OS: Linux Mint
Bash version

`GNU bash, version 4.4.20(1)-release (i686-pc-linux-gnu)`
Top Answer
PeterVandivier
As noted in the [`echo` man page](https://linux.die.net/man/1/echo), `-n` suppresses only the final trailing newline

> -n
> 
> do not output the trailing newline

If you you want to remove the newline character from the body of a block of text, [`tr`](https://linux.die.net/man/1/tr) is the function for you. In the following example the `-d` flag indicates we should delete all instances of the selected character `\n` which is interpreted as "newline". Note the `-n` flag on `echo` is optional in this usage.

```bash
echo -n "This is a two

line string." | tr -d '\n'
```

[tio](https://tio.run/##S0oszvj/PzU5I19BN09BKSQjs1gBiBIVSsrzubhyMvNSFYpLijLz0vWUFGoUSooUdFMU1GPy1P//BwA)

![Screenshot 2020-08-25 at 20.26.27.png](/image?hash=7ab08f87c036d70baf75785832d0959750cd8027f2e6f9d81f86910dbab49945)

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.