Hacker News new | ask | show | jobs
by psophis 2173 days ago
You can also use add a hyphen ( <<-EOF ) to suppress leading tabs but not spaces. https://linuxhint.com/bash-heredoc-tutorial/
3 comments

I've always avoided that for fear that my or someone else's editor will accidentally replace the tabs with space. Mixed is not a common configuration, these days.
This makes me want to use this just to get people to fix their broken editors.
Oh, that's nice! And in spite of the labeling on that page, it doesn't seem to be a BASHism; it at least works in dash, too.
And ksh.
Seriously, bash has too many obscure features.
Ruby and Perl have `here` docs as well.

And Ruby 2.5 has an enhancement which preserves leading whitespace.

a commonly used feature that has been a part of the unix standard since before "bash" only meant to hit something with a heavy object, while linus was getting his diaper changed is not an "obscure feature."

a five year old took his first aware car ride, and at a gas station saw the trunk of the car next to theirs open. he said "seriously, bmw has too many obscure features." after all, a car for him was where you put the baby seat. and why would you put that in a compartment with no windows or air, that's too small to even fit a baby seat.

did you enjoy the ride?