this post was submitted on 05 Sep 2026
7 points (76.9% liked)

Programming

28402 readers
248 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 3 years ago
MODERATORS
 

Back writing in my website.

all 12 comments
sorted by: hot top controversial new old
[–] talkingpumpkin@lemmy.world 4 points 2 days ago (1 children)

is

: <<EOF
  text
  text
EOF

a bash-ism?

[–] EuAndreh@programming.dev 2 points 2 days ago (1 children)

AFAICT, not really, looks line POSIX sh at a glance. Just don't forget to : <<'EOF' instead of : <<EOF.

But : is arguably simpler than cat, one fewer fork/exec call plus no open(2) on /dev/null.

[–] EuAndreh@programming.dev 2 points 2 days ago

I like it, thanks :)

[–] thingsiplay@lemmy.ml 5 points 3 days ago

I think this solves an issue, that's not an issue at all and makes it more complicated and harder to read. What do I mean by that?

It requires more text and exact correct syntax of multiple elements. It makes it harder to see where the start and end is, and one has to look for any lines that could potentially be a comment in a heredoc. The syntax highlighter does not show this in comment color. Bash still executes those lines to read the "comment", as it thinks its normal code. In example variables can still be expanded in heredocs. Other tools removing comments from script to count lines would be fooled too.

Compare this to a single hashtag symbol in the beginning of each comment. That's all. This is also good practice everyone understands. From practical point of view, why would anyone use heredocs for multi line comments over single line comments?

[–] FizzyOrange@programming.dev 4 points 3 days ago (1 children)

Yeah but... Don't. Multiline comments are a bit of an anti-pattern at the best of times. This is a war crime.

[–] EuAndreh@programming.dev 1 points 3 days ago (1 children)

I use this only when developing, mostly while debugging. IIRC I've never commited code like this.

[–] FizzyOrange@programming.dev -1 points 3 days ago (1 children)

Close notepad.exe. Open a real editor. Select the text you want to comment out. Press Ctrl-/

[–] EuAndreh@programming.dev 0 points 3 days ago

No notepad.exe, nvi: 'a,s/^/# /.

[–] CameronDev@programming.dev 2 points 3 days ago (1 children)
[–] EuAndreh@programming.dev 2 points 3 days ago

Oops, renamed the www dir, should be back now.