Preserving newlines / line breaks in BASH

declare f="fafafda
adffd
adfadf
adfafd
afd"

echo $f
echo "vs"
echo "$f"

Output:

$./above
fafafda adffd adfadf adfafd afd
vs
fafafda
adffd
adfadf
adfafd
afd

keywords: \n

This article was updated on 2023-01-25

I'm nabeards. I'm a full stack JavaScript developer. I travel full time, a.k.a., Professional Wanderer, a.k.a., Digital Nomad.