4 ms·
You can also use add a hyphen ( <<-EOF ) to suppress leading tabs but not spaces. https://linuxhint.com/bash-heredoc-tutorial/ https://linuxhint.com/bash-heredo
by psophis 6y ago
You can also use add a hyphen ( <<-EOF ) to suppress leading tabs but not spaces. https://linuxhint.com/bash-heredoc-tutorial/ https://linuxhint.com/bash-heredoc-tutorial/
- yjftsjthsd-h 6y agoOh, 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.
- e12e 6y agoAnd ksh.
- smichel17 6y agoI'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.
- account42 6y agoThis makes me want to use this just to get people to fix their broken editors.
- amelius 6y agoSeriously, bash has too many obscure features.
- ainar-g 6y agoBash? It's POSIX: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_07_04 https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V....
- emmelaich 6y agoRuby and Perl have `here` docs as well. And Ruby 2.5 has an enhancement which preserves leading whitespace.
- bmn__ 6y agohttp://p3rl.org/op#Indented-Here-docs http://p3rl.org/op#Indented-Here-docs
- dungdongdang 6y agoa 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?